home *** CD-ROM | disk | FTP | other *** search
/ Halting the Hacker - A P…uide to Computer Security / Halting the Hacker - A Practical Guide to Computer Security.iso / rfc / rfc1013.txt < prev    next >
Text File  |  1997-04-01  |  239KB  |  5,958 lines

  1.  
  2. Network Working Group                                Robert W. Scheifler
  3. Request for Comments: 1013                                     June 1987
  4.  
  5.  
  6.  
  7.                   X WINDOW SYSTEM PROTOCOL, VERSION 11
  8.                                  Alpha Update
  9.                                   April 1987
  10.      Copyright (c) 1986, 1987 Massachusetts Institute of Technology
  11.                    X Window System is a trademark of M.I.T.
  12.  
  13.  
  14. Status of this Memo
  15.  
  16.    This RFC is distributed to the Internet community for information
  17.    only.  It does not establish an Internet standard.  The X window
  18.    system has been widely reviewed and tested.  The internet community
  19.    is encouraged to experiment with it.  Distribution of this memo is
  20.    unlimited (see copyright notice on page 2).
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. M.I.T.                                                          [Page 1]
  57.  
  58. RFC 1013                                                       June 1987
  59.  
  60.  
  61.    Permission to use, copy, modify, and distribute this document for any
  62.    purpose and without fee is hereby granted, provided that the above
  63.    copyright notice appear in all copies and that both that copyright
  64.    notice and this permission notice are retained, and that the name of
  65.    M.I.T. not be used in advertising or publicity pertaining to this
  66.    document without specific, written prior permission.  M.I.T. makes no
  67.    representations about the suitability of this document or the
  68.    protocol defined in this document for any purpose.  It is provided
  69.    "as is" without express or implied warranty.
  70.  
  71.     Author: Robert W. Scheifler
  72.            Laboratory for Computer Science
  73.            545 Technology Square, Room 418
  74.            Cambridge, MA 02139
  75.  
  76.     Contributors:
  77.            Dave Carver (Digital HPW)
  78.            Branko Gerovac (Digital HPW)
  79.            Jim Gettys (MIT/Project Athena, Digital)
  80.            Phil Karlton (Digital WSL)
  81.            Scott McGregor (Digital SSG)
  82.            Ram Rao (Digital UEG)
  83.            David Rosenthal (Sun)
  84.            Dave Winchell (Digital UEG)
  85.  
  86.     Implementors of initial server who provided useful input:
  87.            Susan Angebranndt (Digital)
  88.            Raymond Drewry (Digital)
  89.            Todd Newman (Digital)
  90.  
  91.     Invited reviewers who provided useful input:
  92.            Andrew Cherenson (Berkeley)
  93.            Burns Fisher (Digital)
  94.            Dan Garfinkel (HP)
  95.            Leo Hourvitz (Next)
  96.            Brock Krizan (HP)
  97.            David Laidlaw (Stellar)
  98.            Dave Mellinger (Interleaf)
  99.            Ron Newman (MIT)
  100.            John Ousterhout (Berkeley)
  101.            Andrew Palay (ITC CMU)
  102.            Ralph Swick (MIT)
  103.            Craig Taylor (Sun)
  104.            Jeffery Vroom (Stellar)
  105.  
  106.    This document does not attempt to provide the rationale or pragmatics
  107.    required to fully understand the protocol or to place it in
  108.    perspective within a  complete system.  Knowledge of X Version 10
  109.    will certainly aid in understanding this document.
  110.  
  111.  
  112.  
  113.  
  114.  
  115. M.I.T.                                                          [Page 2]
  116.  
  117. RFC 1013                                                       June 1987
  118.  
  119.  
  120.    The protocol contains many management mechanisms that are not
  121.    intended for normal applications.  Not all mechanisms are needed to
  122.    build a particular user interface.  It is important to keep in mind
  123.    that the protocol is intended to provide mechanism, not policy.
  124.  
  125.    This document does not attempt to define precise formats or bit
  126.    encodings.
  127.  
  128.    -------------------------------------------------------------------
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174. M.I.T.                                                          [Page 3]
  175.  
  176. RFC 1013                                                       June 1987
  177.  
  178.  
  179.    SECTION 1.  TERMINOLOGY
  180.  
  181.  
  182.    Access control list
  183.            X maintains a list of hosts from which client programs may be
  184.            run.  By default, only programs on the local host may use the
  185.            display, plus any hosts specified in an initial list read by
  186.            the server.  This "access control list" can be changed by
  187.            clients on the local host.  Some server implementations may
  188.            also implement other authorization mechanisms.
  189.  
  190.    Active grab
  191.            A grab is "active" when the pointer or keyboard is actually
  192.            owned by the single grabbing client.
  193.  
  194.    Ancestors
  195.            If W is an inferior of A, then A is an "ancestor" of W.
  196.  
  197.    Atom
  198.            An "atom" is a unique id corresponding to a string name.
  199.            Atoms are used to identify properties, types, and selections.
  200.  
  201.    Backing store
  202.            When a server maintains the contents of a window, the
  203.            off-screen saved pixels are known as a "backing store".
  204.  
  205.    Bit gravity
  206.            When a window is resized, the contents of the window are
  207.            not necessarily discarded.  It is possible to request the
  208.            server (though no guarantees are made) to relocate the
  209.            previous contents to some region of the window.  This
  210.            attraction of window contents for some location of a window
  211.            is known as "bit gravity".
  212.  
  213.    Bitmap
  214.            A "bitmap" is a pixmap of depth one.
  215.  
  216.    Button grabbing
  217.            Buttons on the pointer may be passively "grabbed" by a
  218.            client.  When the button is pressed, the pointer is then
  219.            actively grabbed by the client.
  220.  
  221.    Byte order
  222.            For image (pixmap/bitmap) data, byte order is defined by
  223.            the server, and clients with different native byte ordering
  224.             must swap bytes as necessary.  For all other parts of the
  225.            protocol, the byte order is defined by the client, and the
  226.            server swaps bytes as necessary.
  227.  
  228.    Children
  229.            The "children" of a window are its first-level subwindows.
  230.  
  231.  
  232.  
  233. M.I.T.                                                          [Page 4]
  234.  
  235. RFC 1013                                                       June 1987
  236.  
  237.  
  238.    Client
  239.            An application program connects to the window system server
  240.            by some interprocess communication (IPC) path, such as a TCP
  241.            connection or a shared memory buffer.  This program is the
  242.            window system server.  More precisely, the client is the IPC
  243.            path itself; a program with multiple paths open to the server
  244.            is viewed as multiple clients by the protocol.  Resource
  245.            lifetimes are controlled by connection lifetimes, not by
  246.            program lifetimes.
  247.  
  248.    Clipping regions
  249.            In a graphics context, a bitmap or list of rectangles can
  250.            be specified to restrict output to a particular region of
  251.            the window.  The image defined by the bitmap or rectangles
  252.            is called a "clipping region".
  253.  
  254.    Color cell
  255.            An entry in a colormap is known as a "color cell".  An entry
  256.            contains three values specifying red, green and blue
  257.            intensities.  These values are always viewed as 16 bit
  258.            unsigned numbers, with zero being minimum intensity.  The
  259.            values are scaled by the server to match the display
  260.            hardware.  The components of a cell are coincident with
  261.            components of other cells in DirectColor and TrueColor
  262.            colormaps.
  263.  
  264.    Colormap
  265.            A "colormap" consists of a set of color cells.  A pixel value
  266.            indexes the color map to produce intensities to be displayed.
  267.            Depending on hardware limitations, one or more colormaps may
  268.            be installed at one time, such that windows associated with
  269.            those maps display with true colors.
  270.  
  271.    Connection
  272.            The IPC path between the server and client program is known
  273.            as a "connection".  A client program typically (but not
  274.            necessarily) has one connection to the server over which
  275.            requests and events are sent.
  276.  
  277.    Containment
  278.            A window "contains" the pointer if the window is viewable and
  279.            the hotspot of the cursor is within a visible region of the
  280.            window or a visible region of one of its inferiors.  The
  281.            border of the window is included as part of the window for
  282.            containment.  The pointer is "in" a window if the window
  283.            contains the pointer but no inferior contains the pointer.
  284.  
  285.    Coordinate system
  286.            The coordinate system has X horizontal and Y vertical, with
  287.            the origin [0, 0] at the upper left.  Coordinates are
  288.            discrete, and in terms of pixels.  Each window and pixmap has
  289.  
  290.  
  291.  
  292. M.I.T.                                                          [Page 5]
  293.  
  294. RFC 1013                                                       June 1987
  295.  
  296.  
  297.            its own coordinate system.  For a window, the origin is at
  298.            the inside upper left, inside the border.
  299.  
  300.    Cursor
  301.            A "cursor" is the visible shape of the pointer on a screen.
  302.            It consist of a hot spot, a source bitmap, a shape bitmap,
  303.            and a pair of colors.  The cursor defined for a window
  304.            controls the visible appearance when the pinter is in that
  305.            window.
  306.  
  307.    Depth
  308.            The "depth" of a window or pixmap is number of bits per pixel
  309.            it has. The depth of a gcontext is the depth of the root of
  310.            the gcontext.
  311.  
  312.    Device
  313.            Keyboards, mice, tablets, track-balls, button boxes, etc. are
  314.            all collectively known as input "devices".  The core protocol
  315.            only deals with two devices, "the keyboard" and "the
  316.            pointer".
  317.  
  318.    Drawable
  319.            Both windows and pixmaps may be used as sources and
  320.            destinations  in graphics operations.  These are collectively
  321.            known as "drawables". However, an InputOnly window cannot be
  322.            used as a source or destination in a graphics operation.
  323.  
  324.    Event
  325.            Clients are informed of information asynchronously via
  326.            "events". These events may be either asynchronously generated
  327.            from devices, or generated as side effects of client
  328.            requests.  Events are grouped into types; events are never
  329.            sent to a client by the server unless the client has
  330.            specificially asked to be informed of that type of event,
  331.            but other clients can force events to be sent to other
  332.            clients. Events are typically reported relative to a window.
  333.  
  334.    Event mask
  335.            Events are requested relative to a window.  The set of event
  336.            types a client requests relative to a window described using
  337.            an "event mask".
  338.  
  339.    Event sychronization
  340.            There are certain race conditions possible when
  341.            demultiplexing device events to clients (in particular
  342.            deciding where pointer and keyboard events should be sent
  343.            when in the middle of window management operations).  The
  344.            event synchronization mechanism allows synchronous processing
  345.            of device events.
  346.  
  347.  
  348.  
  349.  
  350.  
  351. M.I.T.                                                          [Page 6]
  352.  
  353. RFC 1013                                                       June 1987
  354.  
  355.  
  356.    Event propagation
  357.            Device-related events "propagate" from the source window to
  358.            ancestor windows until some client has expressed interest in
  359.            handling that type of event, or until the event is discarded
  360.            explicitly.
  361.  
  362.    Event source
  363.            The smallest window containing the pointer is the "source"
  364.            of a device related event.
  365.  
  366.    Exposure event
  367.            Servers do not guarantee to preserve the contents of windows
  368.            when windows are obscured or reconfigur contents of regions
  369.            of windows have been lost.
  370.  
  371.    Extension
  372.            Named "extensions" to the core protocol can be defined to
  373.            extend the system.  Extension to output requests, resources,
  374.            and event types are all possible, and expected.
  375.  
  376.    Font
  377.            A "font" is an array of glyphs (typically characters).  The
  378.            protocol does no translation or interpretation of character
  379.            sets.  The client simply indicates values used to index the
  380.            glyph array.  A font contains additional metric information
  381.            to determine inter-glyph and inter-line spacing.
  382.  
  383.    Glyph
  384.            A "glyph" is an image, typically of a character, in a font.
  385.  
  386.    Grab
  387.            Keyboard keys, the keyboard, pointer buttons, the pointer,
  388.            and the server can be "grabbed" for exclusive use by a
  389.            client.  In general, these facilities are not intended to be
  390.            used by normal applications, but are intended for various
  391.            input and window managers to implement various styles of
  392.            user interfaces.
  393.  
  394.    Graphics context
  395.            Various information for graphics output is stored in "GC"'s,
  396.            such as foreground pixel, background pixel, line width,
  397.            clipping region, etc.
  398.  
  399.    Hotspot
  400.            A cursor has an associated "hot spot" which defines a point
  401.            in the cursor that corresponds to the coordinates reported
  402.            for the pointer.
  403.  
  404.    Identifier
  405.            Each resource has an "identifier", a unique value associated
  406.            with it that clients use to name the resource.  An identifier
  407.  
  408.  
  409.  
  410. M.I.T.                                                          [Page 7]
  411.  
  412. RFC 1013                                                       June 1987
  413.  
  414.  
  415.            can be used over any connection to name the resource.
  416.  
  417.    Inferiors
  418.            The "inferiors" of a window are all of the subwindows nested
  419.            below it: the children, the children's children, etc.
  420.  
  421.    Input focus
  422.            The "input focus" is nominally where keyboard input goes.
  423.            Keyboard events are by default sent to the client expressing
  424.            interest on the window the pointer is in.  This is said to be
  425.            a "real estate driven" input focus.  It is also possible to
  426.            attach the keyboard input to a  specific window; events will
  427.            then be sent to the appropriate client independent of the
  428.            pointer position.
  429.  
  430.    Input manager
  431.            Control over keyboard input is typically provided by an
  432.            "input manager" client.
  433.  
  434.    InputOnly window
  435.            A window that cannot be used for graphics requests.
  436.            InputOnly windows are "invisible", and can be used to control
  437.            such things as cursors, input event generation, and grabbing.
  438.  
  439.    InputOutput window
  440.            The "normal" kind of opaque window, used for both input
  441.            and output.
  442.  
  443.    Key grabbing
  444.            Keys on the keyboard may be passively "grabbed" by a client.
  445.            When the key is pressed, the keyboard is then actively
  446.            grabbed by the client.
  447.  
  448.    Keyboard grabbing
  449.            A client can actively "grab" control of the keyboard, and key
  450.            events will be sent to that client rather than the client the
  451.            events would normally have been sent to.
  452.  
  453.    Mapping
  454.            A window is said to be "mapped" if a map call has been
  455.            performed on it.  Unmapped windows are never viewable or
  456.            visible.
  457.  
  458.    Modifier keys
  459.            Shift, Control, Meta, Super, Hyper, ALT, Compose, Apple,
  460.            CapsLock, ShiftLock, and similar keys are called "modifier"
  461.            keys.
  462.  
  463.    Obscures
  464.            Window A "obscures" window B if both are viewable
  465.            InputOutput windows and A is higher in the global stacking
  466.  
  467.  
  468.  
  469. M.I.T.                                                          [Page 8]
  470.  
  471. RFC 1013                                                       June 1987
  472.  
  473.  
  474.            order, and the rectangle defined by the outside edges of
  475.            intersects the rectangle defined by the outside edges of B.
  476.            Note the (fine) distinction with "occludes". Also note that
  477.            window borders are included in the calculation.
  478.  
  479.    Occludes
  480.            Window A "occludes" window B if both are mapped and A is
  481.            higher in the global stacking order, and the rectangle
  482.            defined by the outside edges of A intersects the rectangle
  483.            defined by the outside edges of B.  Note the (fine)
  484.            distinction with "obscures".  Also note that window borders
  485.            are included in the calculation.
  486.  
  487.    Padding
  488.            Some padding bytes are inserted in the data stream to
  489.            maintain alignment of the protocol requests on natural
  490.            boundaries.  This increases ease of portability to some
  491.            machine architectures.
  492.  
  493.    Parent window
  494.            If C is a child of P, then P is the "parent" of C.
  495.  
  496.    Passive grab
  497.            Grabbing a key or button is a "passive" grab.  The grab
  498.            activates when the key or button is actually pressed.
  499.  
  500.    Pixel value
  501.            A "pixel" is an N-bit value, where N is the number of bit
  502.            planes used in a particular window or pixmap.  For a window,
  503.            a pixel value indexes a colormap to derive an actual color
  504.            to be displayed.
  505.  
  506.    Pixmap
  507.            A "pixmap" is a three dimensional array of bits.  A pixmap
  508.            is normally thought of as a two dimensional array of pixels,
  509.            where each pixel can be a value from 0 to (2^N)-1, where N
  510.            is the depth (z axis) of the pixmap.  A pixmap can also be
  511.            thought of as a stack of N bitmaps.
  512.  
  513.    Plane mask
  514.            Graphics operations can be restricted to only affect a
  515.            subset of bit planes of a destination.  A "plane mask" is
  516.            a bit mask describing which planes are to be modified, and
  517.            is stored in a graphics context.
  518.  
  519.    Pointer
  520.            The "pointer" is the pointing device attached to the cursor,
  521.            and tracked on the screens.
  522.  
  523.    Pointer grabbing
  524.            A client can actively "grab" control of the pointer, and
  525.  
  526.  
  527.  
  528. M.I.T.                                                          [Page 9]
  529.  
  530. RFC 1013                                                       June 1987
  531.  
  532.  
  533.            button and motion events will be sent to that client rather
  534.            than the client the events would normally have been sent to.
  535.  
  536.    Pointing device
  537.            A "pointing device" is typically a mouse or tablet, or some
  538.            other device with effective dimensional motion.  There is
  539.            only one visible cursor is defined by the core protocol,
  540.            and it tracks whatever pointing device is attached as the
  541.            pointer.
  542.  
  543.    Property
  544.            Windows may have associated "properties", consisting of a
  545.            name, a type, a data format, and some data.  The protocol
  546.            places no interpretation on properties, they are intended
  547.            as a general-purpose naming mechanism for clients.  For
  548.            example, clients might share information such as resize
  549.            hints, program names, and icon formats with a window
  550.            manager via properties.
  551.  
  552.    Property list
  553.            The "property list" of a window is the list of properties
  554.            that have been defined for the window.
  555.  
  556.    Redirecting control
  557.            Window managers (or client programs) may wish to enforce
  558.             window layout policy in various ways.  When a client
  559.            attempts to change the size or position of a window, the
  560.            operation may be "redirected" to a specified client,
  561.            rather than the operation actually being performed.
  562.  
  563.    Reply
  564.            Information requested by a client program is sent back to
  565.            the client with a "reply".  Both events and replys are
  566.            multipexed on the same connection.  Most requests do not
  567.            generate replies.
  568.  
  569.    Request
  570.            A command to the server is called a "request".  It is a
  571.            single block of data sent over a connection.
  572.  
  573.    Resource
  574.            Windows, pixmaps, cursors, fonts, graphics contexts, and
  575.            colormaps are known as "resources".  They all have unique
  576.            identifiers associated with them for naming purposes.  The
  577.            lifetime of a resource is bounded by the lifetime of the
  578.            connection over which the resource was created.
  579.  
  580.    Root
  581.            The "root" of a pixmap or gcontext is the same as the root
  582.            of whatever drawable was used when the pixmap or gcontext
  583.            was created.  The "root" of a window is the root window
  584.  
  585.  
  586.  
  587. M.I.T.                                                         [Page 10]
  588.  
  589. RFC 1013                                                       June 1987
  590.  
  591.  
  592.            under which the window was created.
  593.  
  594.    Root window
  595.            Each screen has a "root window" covering it.  It cannot be
  596.            reconfigured or unmapped, but otherwise acts as a full
  597.            fledged window. A root window has no parent.
  598.  
  599.    Save set
  600.            The "save set" of a client is a list of other client's
  601.            windows which, if they are inferiors of one of the client's
  602.            windows at connection close, should not be destroyed, and
  603.            which should be remapped if it is unmapped.  Save sets are
  604.            typically used by window managers to avoid lost windows if
  605.            the manager should terminate abnormally.
  606.  
  607.    Screen
  608.            A server may provide several independent "screens", which
  609.            typically have physically independent monitors.  This would
  610.            be the expected configuration when there is only a single
  611.            keyboard and pointer shared among the screens.
  612.  
  613.    Server
  614.            The "server" provides the basic windowing mechanism.  It
  615.            handles IPC connections from clients, demultipexes graphics
  616.            requests onto the screens, and multiplexes input back to the
  617.            appropriate clients.
  618.  
  619.    Server grabbing
  620.            The server can be "grabbed" by a single client for exclusive
  621.            use. This prevents processing of any requests from other
  622.            client connections until the grab is complete.  This is
  623.            typically only a transient state for such things as
  624.            rubber-banding and pop-up menus, or to execute requests
  625.            indivisibly.
  626.  
  627.    Sibling
  628.            Children of the same parent window are known as "sibling"
  629.            windows.
  630.  
  631.    Stacking order
  632.            Sibling windows may "stack" on top of each other.  Windows
  633.            above both obscure and occlude lower windows.  This is
  634.            similar to paper on a desk. The relationship between
  635.            sibling windows is known as the "stacking order".
  636.  
  637.    Stipple
  638.            A "stipple pattern" is a bitmap that is used to tile a
  639.            region to serve as an additional clip mask for a fill
  640.            operation with the foreground color.
  641.  
  642.  
  643.  
  644.  
  645.  
  646. M.I.T.                                                         [Page 11]
  647.  
  648. RFC 1013                                                       June 1987
  649.  
  650.  
  651.    Tile
  652.            A pixmap can be replicated in two dimensions to "tile"
  653.            a region.  The pixmap itself is also known as a "tile".
  654.  
  655.    Timestamp
  656.            A time value, expressed in milliseconds, typically since
  657.            the last server reset.  Timestamp values wrap around (after
  658.            about 49.7 days). The server, given its current time is
  659.            represented by timestamp T, always interprets timestamps
  660.            from clients by treating half of the timestamp space as
  661.            being earlier in time than T, and half of the timestamp
  662.            space as being later in time than T.  One timestamp value
  663.            (named CurrentTime) is never generated by the server;
  664.            this value is reserved for use in requests to represent
  665.            the current server time.
  666.  
  667.    Type
  668.            A type is an arbitrary atom used to identify the
  669.            interpretation of property data.  Types are completely
  670.            uninterpreted by the server; they are solely for the
  671.            benefit of clients.
  672.  
  673.    Unviewable
  674.            A window is "unviewable" if it is mapped but some ancestor is
  675.            unmapped.
  676.  
  677.    Viewable
  678.            A window is "viewable" if it and all of its ancestors are
  679.            mapped.  This does not imply that any portion of the window
  680.            is actually visible.
  681.  
  682.    Visible
  683.            A region of a window is "visible" if someone looking at the
  684.            screen can actually "see" it:  the window is viewable and the
  685.            region is not occluded by any other window.
  686.  
  687.    Window gravity
  688.            When windows are resized, subwindows may be repositioned
  689.            automatically relative to some position in the window.  This
  690.            attraction of a subwindow to some part of its parent is known
  691.            as "window gravity".
  692.  
  693.    Window manager
  694.            Manipulation of windows on the screen, and much of the user
  695.            interface (policy) is typically provided by a "window
  696.            manager" client.
  697.  
  698.    XYFormat
  699.            The data for a pixmap is said to be in "XYFormat" if it is
  700.            organized as a set of bitmaps representing individual bit
  701.            planes.
  702.  
  703.  
  704.  
  705. M.I.T.                                                         [Page 12]
  706.  
  707. RFC 1013                                                       June 1987
  708.  
  709.  
  710.    ZFormat
  711.            The data for a pixmap is said to be in "ZFormat" if it is
  712.            organized as a set of pixel values in scanline order.
  713.  
  714. SECTION 2.  PROTOCOL FORMATS
  715.  
  716.  
  717. Request Format
  718.  
  719.    Every request contains an 8-bit "major" opcode, and a 16-bit length
  720.    field expressed in units of 4 bytes.  Every request consists of 4
  721.    bytes of header containing the major opcode, the length field, and a
  722.    data byte) followed by zero or more additional bytes of data; the
  723.    length field defines the total length of the request, including the
  724.    header.  The length field in a request must equal the minimum length
  725.    required to contain the request; if the specified length is smaller
  726.    or larger than the required length, an error is enerated.  Unused
  727.    bytes in a request are not required to be zero.  Major opcodes 128
  728.    through 255 are reserved for extensions.  Extensions are intended
  729.    to contain multiple requests, so extension requests typically have
  730.    an additional minor opcode encoded in the "spare" data byte in the
  731.    request header, but the placement and interpretation of this minor
  732.    opcode, and all other fields in extension requests, are not defined
  733.    by the core protocol. Every request is implicitly assigned a sequence
  734.    number, starting with one,used in replies, errors, and events.
  735.  
  736. Reply Format
  737.  
  738.    Every reply contains a 32-bit length field expressed in units of 4
  739.    bytes. Every reply consists of 32 bytes, followed by zero or more
  740.    additional bytes of data, as specified in the length field.  Unused
  741.    bytes within a reply are not guaranteed to be zero.  Every reply
  742.    also contains the least significant 16 bits of the sequence number
  743.    of the corresponding request.
  744.  
  745. Error Format
  746.  
  747.    Error reports are 32 bytes long.  Every error includes an 8-bit error
  748.    code. Error codes 128 through 255 are reserved for extensions.  Every
  749.    error also includes the major and minor opcodes of the failed
  750.    request, and the least significant 16 bits of the sequence number of
  751.    the request.  For the following errors (see Section 5), the failing
  752.    resource id is also returned: Colormap, Cursor, Drawable, Font,
  753.    GContext, IDChoice, Pixmap, and Window.  For Atom errors, the failing
  754.    atom is returned.  For Value errors, the failing value is returned.
  755.    Other core errors return no additional data.  Unused bytes within
  756.    an error are not guaranteed to be zero.
  757.  
  758. Event Format
  759.  
  760.    Events are 32 bytes long.  Unused bytes within an event are not
  761.  
  762.  
  763.  
  764. M.I.T.                                                         [Page 13]
  765.  
  766. RFC 1013                                                       June 1987
  767.  
  768.  
  769.    guaranteed to be zero.  Every event contains an 8-bit type code.  The
  770.    most significant bit in this code is set if the event was generated
  771.    from a SendEvent request. Event codes 64 through 127 are reserved for
  772.    extensions, although the core protocol does not define a mechanism
  773.    for selecting interest in such events. Every core event (with the
  774.    exception of KeymapNotify) also contains the least significant 16
  775.    bits of the sequence number of the last request issued by the client
  776.    that was (or is currently being) processed by the server.
  777.  
  778.  
  779. SECTION 3.  SYNTAX
  780.  
  781.  
  782.    The syntax {...} encloses a set of alternatives.
  783.  
  784.    The syntax [...] encloses a set of structure components.
  785.  
  786.    In general, TYPEs are in upper case and AlternativeValues are
  787.    capitalized.
  788.  
  789.    Requests in Section 10 are described in the following format:
  790.  
  791.        RequestName
  792.                arg1: type1
  793.                ...
  794.                argN: typeN
  795.            =>
  796.                result1: type1
  797.                ...
  798.                resultM: typeM
  799.  
  800.                Errors: kind1, ..., kindK
  801.  
  802.                Description.
  803.  
  804. If no => is present in the description, then the request has no
  805. reply (it is asynchronous), although errors may still be reported.
  806.  
  807. Events in Section 12 are described in the following format:
  808.  
  809.     EventName
  810.             value1: type1
  811.             ...
  812.             valueN: typeN
  813.  
  814.             Description.
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823. M.I.T.                                                         [Page 14]
  824.  
  825. RFC 1013                                                       June 1987
  826.  
  827.  
  828. SECTION 4.  COMMON TYPES
  829.  
  830.  
  831. LISTofFOO
  832.  
  833.    A type name of the form LISTofFOO means a counted list of elements
  834.    of type FOO; the size of the length field may vary (it is not
  835.    necessarily the same size as a FOO), in some cases may be implicit,
  836.    and is not fully specified in this document.
  837.  
  838. BITMASK and LISTofVALUE
  839.  
  840.    The types BITMASK and LISTofVALUE are somewhat special.  Various
  841.    requests contain arguments of the form:
  842.            value-mask: BITMASK
  843.            value-list: LISTofVALUE
  844.    used to allow the client to specify a subset of a heterogeneous
  845.    collection of "optional" arguments.  The value-mask specifies which
  846.    arguments are to be provided; each such argument is assigned a unique
  847.    bit position.  The representation of the BITMASK will typically
  848.    contain more bits than there are defined arguments; unused bits in
  849.    the value-mask must be zero (or the server generates a Value error).
  850.    The value-list contains one value for each one bit in the mask, from
  851.    least to most significant bit in the mask.  Each value is represented
  852.    with 4 bytes, but the actual value occupies only the least
  853.    significant bytes as required; the values of the unused bytes do not
  854.    matter.
  855.  
  856. Or Types
  857.  
  858.    A type of the form "T1 or ... or Tn" means the union of the indicated
  859.    types; a single-element type is given as the element without
  860.    enclosing braces.
  861.  
  862. DEVICE: 32-bit id (<class,model,manufacturer,unit> 8 bits each)
  863. WINDOW: 32-bit id
  864. PIXMAP: 32-bit id
  865. CURSOR: 32-bit id
  866. FONT: 32-bit id
  867. GCONTEXT: 32-bit id
  868. COLORMAP: 32-bit id
  869. DRAWABLE: WINDOW or PIXMAP
  870. ATOM: 32-bit id (top 3 bits guaranteed to be zero)
  871. VISUALID: 32-bit id (top 3 bits guaranteed to be zero)
  872. VALUE: 32-bit quantity (used only in LISTofVALUE)
  873. INT8: 8-bit signed integer
  874. INT16: 16-bit signed integer
  875. INT32: 32-bit signed integer
  876. CARD8: 8-bit unsigned integer
  877. CARD16: 16-bit unsigned integer
  878. CARD32: 32-bit unsigned integer
  879.  
  880.  
  881.  
  882. M.I.T.                                                         [Page 15]
  883.  
  884. RFC 1013                                                       June 1987
  885.  
  886.  
  887. TIMESTAMP: CARD32
  888. BITGRAVITY: {Forget, Static,
  889.              NorthWest, North, NorthEast,
  890.              West, Center, East,
  891.              SouthWest, South, SouthEast}
  892. WINGRAVITY: {Unmap, Static,
  893.              NorthWest, North, NorthEast,
  894.              West, Center, East,
  895.              SouthWest, South, SouthEast}
  896. BOOL: {True, False}
  897. EVENT: {KeyPress, KeyRelease,
  898.         OwnerGrabButton,
  899.         ButtonPress, ButtonRelease, EnterWindow, LeaveWindow,
  900.         PointerMotion, PointerMotionHint,
  901.         Button1Motion, Button2Motion, Button3Motion,
  902.         Button4Motion, Button5Motion, ButtonMotion
  903.         Exposure, VisibilityChange,
  904.         StructureNotify, ResizeRedirect,
  905.         SubstructureNotify, SubstructureRedirect,
  906.         FocusChange,
  907.         PropertyChange, ColormapChange,
  908.         KeymapState}
  909. POINTEREVENT: {ButtonPress, ButtonRelease, EnterWindow, LeaveWindow,
  910.                PointerMotion, PointerMotionHint,
  911.                Button1Motion, Button2Motion, Button3Motion,
  912.                Button4Motion, Button5Motion, ButtonMotion
  913.                KeymapState}
  914. DEVICEEVENT: {KeyPress, KeyRelease,
  915.               ButtonPress, ButtonRelease,
  916.               PointerMotion,
  917.               Button1Motion, Button2Motion, Button3Motion,
  918.               Button4Motion, Button5Motion, ButtonMotion}
  919. KEYCODE: CARD8
  920. BUTTON: CARD8
  921. KEYMASK: {Shift, CapsLock, Control, Mod1, Mod2, Mod3, Mod4, Mod5}
  922. BUTMASK: {Button1, Button2, Button3, Button4, Button5}
  923. KEYBUTMASK: KEYMASK or BUTMASK
  924. STRING8: LISTofCARD8
  925. STRING16: LISTofCHAR2B
  926. CHAR2B: [byte1, byte2: CARD8]
  927. POINT: [x, y: INT16]
  928. RECTANGLE: [x, y: INT16,
  929.             width, height: CARD16]
  930. ARC: [x, y: INT16,
  931.       width, height: CARD16,
  932.       angle1, angle2: INT16]
  933. HOST: [family: {Internet, NS, ECMA, Datakit, DECnet}
  934.        address: LISTofCARD8]
  935.  
  936.    The [x,y] coordinates of a RECTANGLE specify the upper left corner.
  937.  
  938.  
  939.  
  940.  
  941. M.I.T.                                                         [Page 16]
  942.  
  943. RFC 1013                                                       June 1987
  944.  
  945.  
  946.    The primary interpretation of "large" characters in a STRING16 is
  947.    that they are composed of two bytes used to index a 2-D matrix;
  948.    hence the use of CHAR2B rather than CARD16.  This corresponds to
  949.    the JIS/ISO method of indexing two-byte characters.  It is expected
  950.    that most "large" fonts will be defined with two-byte matrix
  951.    indexing.  For large fonts constructed with linear indexing, a
  952.    CHAR2B can be interpreted as a 16-bit number by treating byte1 as
  953.    the most significant byte; this means that clients should always
  954.    transmit such 16-bit character values most significant byte first,
  955.    as the server will never byte-swap CHAR2B quantities.
  956.  
  957.    The length, format, and interpretation of a HOST address are specific
  958.    to the family.
  959.  
  960.  
  961. SECTION 5.  ERRORS
  962.  
  963.    In general, when a request terminates with an error, the request has
  964.    no side effects (i.e., there is no partial execution).  The only
  965.    requests for which this is not true are ChangeWindowAttributes,
  966.    ChangeGC, PolyText8, PolyText16, FreeColors, StoreColors, and
  967.    ChangeKeyboardControl.
  968.  
  969.    The following error codes can be returned by the various requests:
  970.  
  971. Access
  972.            An attempt to grab a key/button combination already grabbed
  973.            by another client.
  974.  
  975.            An attempt to free a colormap entry not allocated by the
  976.            client.
  977.  
  978.            An attempt to store into a read-only or an unallocated
  979.            colormap entry.
  980.  
  981.            An attempt to modify the access control list from other than
  982.            the local (or otherwise authorized) host.
  983.  
  984.            An attempt to select an event type, that at most one client
  985.            can select at a time, when another client has already
  986.            selected it.
  987.  
  988. Alloc
  989.            The server failed to allocate the requested resource.
  990.  
  991.            Note that this only covers allocation errors at a very coarse
  992.            level, and is not intended to (nor can it in practice hope
  993.            to) cover all cases of a server running out of allocation
  994.            space in the middle of service.
  995.  
  996.  
  997.  
  998.  
  999.  
  1000. M.I.T.                                                         [Page 17]
  1001.  
  1002. RFC 1013                                                       June 1987
  1003.  
  1004.  
  1005.            The semantics when a server runs out of allocation space are
  1006.            left unspecified.
  1007.  
  1008. Atom
  1009.            A value for an ATOM argument does not name a defined ATOM.
  1010.  
  1011. Colormap
  1012.            A value for a COLORMAP argument does not name a defined
  1013.            COLORMAP.
  1014.  
  1015. Cursor
  1016.            A value for a CURSOR argument does not name a defined CURSOR.
  1017.  
  1018. Drawable
  1019.            A value for a DRAWABLE argument does not name a defined
  1020.            WINDOW or PIXMAP.
  1021.  
  1022. Font
  1023.            A value for a FONT or <FONT or GCONTEXT> argument does not
  1024.            name a defined FONT.
  1025.  
  1026. GContext
  1027.            A value for a GCONTEXT argument does not name a defined
  1028.            GCONTEXT.
  1029.  
  1030. IDChoice
  1031.            The value chosen for a resource identifier is either not
  1032.            included in the range assigned to the client, or is already
  1033.            in use.
  1034.  
  1035. Implementation
  1036.            The server does not implement some aspect of the request.  A
  1037.            server which generates this error for a core request is
  1038.            deficient.  As such, this error is not listed for any of the
  1039.            requests, but clients should be prepared to receive such
  1040.            errors, and handle or discard them.
  1041.  
  1042. Length
  1043.            The length of a request is shorter or longer than that
  1044.            required to minimally contain the arguments.
  1045.  
  1046. Match
  1047.            An InputOnly window is used as a DRAWABLE.
  1048.  
  1049.            Some argument (or pair of arguments) has the correct type and
  1050.            range, but fails to "match" in some other way required by the
  1051.            request.
  1052.  
  1053. Name
  1054.            A font or color of the specified name does not exist.
  1055.  
  1056.  
  1057.  
  1058.  
  1059. M.I.T.                                                         [Page 18]
  1060.  
  1061. RFC 1013                                                       June 1987
  1062.  
  1063.  
  1064. Pixmap
  1065.            A value for a PIXMAP argument does not name a defined PIXMAP.
  1066.  
  1067. Property
  1068.            The requested property does not exist for the specified
  1069.            window.
  1070.  
  1071. Request
  1072.            The major or minor opcode does not specify a valid request.
  1073.  
  1074. Value
  1075.            Some numeric value falls outside the range of values accepted
  1076.            by the request.  Unless a specific range is specified for an
  1077.            argument, the full range defined by the argument's type is
  1078.            accepted.  Any argument defined as a set of alternatives can
  1079.            generate this error.
  1080.  
  1081. Window
  1082.            A value for a WINDOW argument does not name a defined WINDOW.
  1083.  
  1084.  
  1085. Note:  the Atom, Colormap, Cursor, Drawable, Font, GContext, Pixmap,
  1086. and Window errors are also used when the argument type is extended
  1087. by union with a set of fixed alternatives, e.g.,<Window or
  1088. PointerRoot or None>.
  1089.  
  1090. SECTION 6.  KEYBOARDS
  1091.  
  1092.    Keycodes are always in the inclusive range [8,255].
  1093.  
  1094.    For keyboards with both left-side and right-side modifier keys (e.g.,
  1095.    Shift and Control), the mask bits in the protocol always define the
  1096.    OR of the keys. If electronically distinguishable, they can have
  1097.    separate up/down events generated, and clients that want to
  1098.    distinguish can track the individual states manually.
  1099.  
  1100.    <As part of the core we need to define a universal association
  1101.    between keycaps and keycodes.  A keycap is the graphical information
  1102.    imprinted on a keyboard key, e.g., "$ 4", "T", "+ =".>
  1103.  
  1104.  
  1105. SECTION 7.  POINTERS
  1106.  
  1107.    Buttons are always numbered starting with one.
  1108.  
  1109.  
  1110. SECTION 8.  PREDEFINED ATOMS
  1111.  
  1112.    Predefined atoms are not strictly necessary, and may not be useful in
  1113.    all environments, but will eliminate many InternAtom requests in most
  1114.    applications.  The core protocol imposes no semantics on these names,
  1115.  
  1116.  
  1117.  
  1118. M.I.T.                                                         [Page 19]
  1119.  
  1120. RFC 1013                                                       June 1987
  1121.  
  1122.  
  1123.    except as they are used in FONTPROP structures (see QueryFont).  Note
  1124.    that upper/lower case matters.
  1125.  
  1126.       BITMAP               ICON_SIZE               RGB_GREEN_MAP
  1127.       COMMAND              ITALIC_ANGLE            RGB_RED_MAP
  1128.       COPYRIGHT            MAX_SPACE               SECONDARY
  1129.       CUT_BUFFER0          MIN_SPACE               SIZE_HINTS
  1130.       CUT_BUFFER1          NAME                    STRIKEOUT_ASCENT
  1131.       CUT_BUFFER2          NORMAL_HINTS            STRIKEOUT_DESCENT
  1132.       CUT_BUFFER3          NORM_SPACE              STRING
  1133.       CUT_BUFFER4          PIXMAP                  SUBSCRIPT_X
  1134.       CUT_BUFFER5          POINT_SIZE              SUBSCRIPT_Y
  1135.       CUT_BUFFER6          PRIMARY                 SUPERSCRIPT_X
  1136.       CUT_BUFFER7          QUAD_WIDTH              SUPERSCRIPT_Y
  1137.       DEFAULT_CHAR         RECTANGLE               UNDERLINE_POSITION
  1138.       END_SPACE            RESIZE_HINT             UNDERLINE_THICKNESS
  1139.       FACE_NAME            RESOLUTION              WEIGHT
  1140.       FAMILY_NAME          RGB_BEST_MAP            WINDOW
  1141.       FONT_ASCENT          RGB_BLUE_MAP            WM_HINTS
  1142.       FONT_DESCENT         RGB_COLOR_MAP           X_HEIGHT
  1143.       ICON                 RGB_DEFAULT_MAP         ZOOM_HINTS
  1144.       ICON_NAME
  1145.  
  1146.  
  1147. SECTION 9.  CONNECTION SETUP
  1148.  
  1149.    For remote clients, the X protocol can be built on top of any
  1150.    reliable byte stream.  For TCP connections, displays on a given host
  1151.    a numbered starting from 0, and the server for display N listens and
  1152.    accepts connections on port 6000+N.
  1153.  
  1154.    The client must send an initial byte of data to identify the byte
  1155.    order to be employed.  The value of the byte must be octal 102 or
  1156.    154.  The value 102 (ASCII uppercase B) means values are transmitted
  1157.    most significant byte first, and value 154 (ASCII lowercase l) means
  1158.    values are transmitted least significant byte first.  Except where
  1159.    explicitly noted in the protocol, all 16-bit and 32-bit quantities
  1160.    sent by the client must be transmitted with this byte order, and all
  1161.    16-bit and 32-bit quantities returned by the server will be
  1162.    transmitted with this byte order.
  1163.  
  1164.    Following the byte-order byte, the following information is sent by
  1165.    the client at connection setup:
  1166.  
  1167.            protocol-major-version: CARD16
  1168.            protocol-minor-version: CARD16
  1169.            authorization-protocol-name: STRING8
  1170.            authorization-protocol-data: STRING8
  1171.  
  1172.            The version numbers indicate what version of the protocol the
  1173.            client expects the server to implement.  See below for an
  1174.  
  1175.  
  1176.  
  1177. M.I.T.                                                         [Page 20]
  1178.  
  1179. RFC 1013                                                       June 1987
  1180.  
  1181.  
  1182.            explanation. The authorization name indicates what
  1183.            authorization protocol the client expects the server to use,
  1184.            and the data is specific to that protocol. Specification of
  1185.            valid authorization mechanisms is not part of the core X
  1186.            protocol.  It is hoped that eventually one authorization
  1187.            protocol will be agreed upon.  In the mean time, a server
  1188.            that implements a different protocol than the client expects,
  1189.            or a server that only implements the host-based mechanism,
  1190.            will simply ignore this information.
  1191.  
  1192.    Received by the client at connection setup:
  1193.            success: BOOL
  1194.            protocol-major-version: CARD16
  1195.            protocol-minor-version: CARD16
  1196.            length: CARD16
  1197.  
  1198.            Length is the amount of additional data to follow, in units
  1199.            of 4 bytes. The version numbers are an escape hatch in case
  1200.            future revisions of the protocol are necessary.  In general,
  1201.            the major version would increment for incompatible changes,
  1202.            and the minor version would increment for small upward
  1203.            compatible changes.  Barring changes, the major version
  1204.            will be eleven, and the minor version will be zero.  The
  1205.            protocol version numbers returned indicate the protocol the
  1206.            server actually supports.  This might not equal the version
  1207.            sent by the client.  The server can (but need not) refuse
  1208.            connections from clients that offer a different version
  1209.            than the server supports.  A server can (but need not)
  1210.            support more than one version simultaneously.
  1211.  
  1212.    Additional data received if authorization fails:
  1213.            reason: STRING8
  1214.  
  1215.    Additional data received if authorization is accepted:
  1216.            vendor: STRING8
  1217.            release-number: CARD32
  1218.            resource-id-base, resource-id-mask: CARD32
  1219.            image-byte-order: {LSBFirst, MSBFirst}
  1220.            bitmap-format-scanline-unit: {8, 16, 32}
  1221.            bitmap-format-scanline-pad: {8, 16, 32}
  1222.            bitmap-format-bit-order: {LeastSignificant, MostSignificant}
  1223.            pixmap-formats: LISTofFORMAT
  1224.            roots: LISTofSCREEN
  1225.            keyboard: DEVICE
  1226.            pointer: DEVICE
  1227.            motion-buffer-size: CARD32
  1228.            maximum-request-length: CARD16
  1229.  
  1230.            where
  1231.  
  1232.              FORMAT: [depth: CARD8,
  1233.  
  1234.  
  1235.  
  1236. M.I.T.                                                         [Page 21]
  1237.  
  1238. RFC 1013                                                       June 1987
  1239.  
  1240.  
  1241.                       bits-per-pixel: {4, 8, 16, 24, 32}
  1242.                       scanline-pad: {8, 16, 32}]
  1243.              SCREEN: [root: WINDOW
  1244.                       device: DEVICE
  1245.                       width-in-pixels, height-in-pixels: CARD16
  1246.                       width-in-millimeters,height-in-millimeters:CARD16
  1247.                       allowed-depths: LISTofDEPTH
  1248.                       root-depth: CARD8
  1249.                       root-visual: VISUALID
  1250.                       default-colormap: COLORMAP
  1251.                       white-pixel, black-pixel: CARD32
  1252.                       min-installed-maps, max-installed-maps: CARD16
  1253.                       backing-stores: {Never, WhenMapped, Always}
  1254.                       save-unders: BOOL
  1255.                       current-input-masks: SETofEVENT]
  1256.             DEPTH: [depth: CARD8
  1257.                       visuals: LISTofVISUALTYPE]
  1258.             VISUALTYPE: [visual-id: VISUALID
  1259.                          class: {StaticGray, StaticColor,
  1260.                                  TrueColor,GrayScale, PseudoColor,
  1261.                                  DirectColor}
  1262.                                  red-mask, green-mask, blue-mask: CARD32
  1263.                                  bits-per-rgb-value: CARD8
  1264.                                  colormap-entries: CARD16]
  1265.  
  1266.    Per server information:
  1267.  
  1268.    The vendor string gives some indentification of the owner of the
  1269.    server implementation.  The semantics of the release-number is
  1270.    controlled by the vendor.
  1271.  
  1272.    The resource-id-mask contains a single contiguous set of bits (at
  1273.    least 18); the client allocates resource ids by choosing a value
  1274.    with (only) some subset of these bits set, and ORing it with
  1275.    resource-id-base.  Only values constructed in this way can be
  1276.    used to name newly created resources over this connection.
  1277.    Resource ids never have the top 3 bits set.  The client is not
  1278.    restricted to linear or contiguous allocation of resource ids.
  1279.    Once an id has been freed, it can be reused, but this should not
  1280.    be necessary. An id must be unique with respect to the ids of
  1281.    all other resources, not just other resources of the same type.
  1282.  
  1283.    Although the server is in general responsible for byte swapping
  1284.    data to match the client, images are always transmitted and
  1285.    received in formats (including byte order) specified by the
  1286.    server.  The byte order for images is given by image-byte-order,
  1287.    and applies to each scanline unit in XYFormat (bitmap) format,
  1288.    and to each pixel value in ZFormat.
  1289.  
  1290.    A bitmap is represented in scanline order.  Each scanline is padded
  1291.    to a multiple of bits as given by bitmap-format-scanline-pad.  The
  1292.  
  1293.  
  1294.  
  1295. M.I.T.                                                         [Page 22]
  1296.  
  1297. RFC 1013                                                       June 1987
  1298.  
  1299.  
  1300.    pad bits are of arbitrary value.  The scanline is quantized in
  1301.    multiples of bits as given by bitmap-format-scanline-unit.  Within
  1302.    each unit, the leftmost bit in the bitmap is either the least or
  1303.    most significant bit in the unit, as given by
  1304.    bitmap-format-bit-order.  If a pixmap is represented in XYFormat,
  1305.    each plane is represented as a bitmap, and the planes appear from
  1306.    most to least significant in bit order.
  1307.  
  1308.    For each pixmap depth supported by some screen, pixmap-formats lists
  1309.    the ZFormat used to represent images of that depth.  In ZFormat, the
  1310.    pixels are in scanline order, left to right within a scanline.  The
  1311.    number of bits used to hold each pixel is given by bits-per-pixel,
  1312.    and may be larger than strictly required by the depth.  When the
  1313.    bits-per-pixel is 4, the order of nibbles in the byte is the same as
  1314.    the image byte-order.  Each scanline is padded to a multiple of bits
  1315.    as given by scanline-pad.
  1316.  
  1317.    How a pointing device roams the screens is up to the server
  1318.    implementation, and is transparent to the protocol.  No geometry
  1319.    among screens is defined.
  1320.  
  1321.    The server may retain the recent history of pointer motion, and to a
  1322.    finer granularity than is reported by MotionNotify events.  Such
  1323.    history is available via the GetPointerMotions request.  The
  1324.    approximate size of the history buffer is given by
  1325.    motion-buffer-size.
  1326.  
  1327.    Maximum-request-length specifies the maximum length of a request, in
  1328.    4-byte units, accepted by the server; i.e., this is the maximum value
  1329.    that can appear in the length field of a request.  Requests larger
  1330.    than this generate a Length error, and the server will read and
  1331.    simply discard the entire request.  Maximum-request-length will
  1332.    always be at least 4096 (i.e., requests of length up to and including
  1333.    16384 bytes will be accepted by all servers).
  1334.  
  1335.    Per screen information:
  1336.  
  1337.    The allowed-depths specifies what pixmap and window depths are
  1338.    supported.  Pixmaps are supported for each depth listed, and windows
  1339.    of that depth are supported if at least one visual type is listed for
  1340.    the depth.  A pixmap depth of one is always supported and listed, but
  1341.    windows of depth one might not be supported.  A depth of zero is
  1342.    never listed, but zero-depth InputOnly windows are always supported.
  1343.  
  1344.    Root-depth and root-visual specify the depth and visual type of the
  1345.    root window.  Width-in-pixels and height-in-pixels specify the size
  1346.    of the root window (which cannot be changed).  The class of the root
  1347.    window is always InputOutput.  Width-in-millimeters and
  1348.    height-in-millimeters can be used to determine the physical size and
  1349.    the aspect ratio.
  1350.  
  1351.  
  1352.  
  1353.  
  1354. M.I.T.                                                         [Page 23]
  1355.  
  1356. RFC 1013                                                       June 1987
  1357.  
  1358.  
  1359.    The default-colormap is the one initially associated with the root
  1360.    window.  Clients with minimal color requirements creating windows of
  1361.    the same depth as the root may want to allocate from this map by
  1362.    default.
  1363.  
  1364.    Black-pixel and white-pixel can be used in implementing a
  1365.    "monochrome" application.  These pixel values are for permanently
  1366.    allocated entries in the default-colormap; the actual RGB values may
  1367.    be settable on some screens.
  1368.  
  1369.    The border of the root window is initially a pixmap filled with the
  1370.    black-pixel.  The initial background of the root window is a pixmap
  1371.    filled with some unspecified two-color pattern using black-pixel and
  1372.    white-pixel.
  1373.  
  1374.    Min-installed-maps specifies the number of maps that can be
  1375.    guaranteed to installed simultaneously (with InstallColormap),
  1376.    regardless of the number of entries allocated in each map.
  1377.    Max-installed-maps specifies the maximum number of maps that might
  1378.    possibly be installed simultaneously, depending on their
  1379.    allocations. For the typical case of a single hardware colormap,
  1380.    both values will be one.
  1381.  
  1382.    Backing-stores indicates when the server supports backing stores for
  1383.    this screen, although it may be storage limited in the number of
  1384.    windows it can support at once.  If save-unders is True, then the a
  1385.    server can support the save-under mode in CreateWindow and
  1386.    ChangeWindowAttributes, although again it may be storage limited.
  1387.  
  1388.    The current-input-events is what GetWindowAttributes would return for
  1389.    the all-event-masks for the root window.
  1390.  
  1391.    Per visual-type information:
  1392.  
  1393.    A given visual type might be listed for more than one depth, or for
  1394.    more than one screen.
  1395.  
  1396.    For PseudoColor, a pixel value indexes a colormap to produce
  1397.    independent RGB values; the RGB values can be changed dynamically.
  1398.    GrayScale is treated the same as PseudoColor, except which primary
  1399.    drives the screen is undefined, so the client should always store
  1400.    the same value for red, green, and blue in colormaps.  For
  1401.    DirectColor, a pixel value is decomposed into separate RGB
  1402.    subfields, and each subfield separately indexes the colormap for
  1403.    the corresponding value; The RGB values can be changed dynamically.
  1404.    TrueColor is treated the same as DirectColor, except the colormap
  1405.    has predefined read-only RGB values, which are server-dependent,
  1406.    but provide (near-)linear ramps in each primary.  StaticColor is
  1407.    treated the same as PseudoColor, except the colormap has
  1408.    predefined read-only RGB values, which are server-dependent.
  1409.    StaticGray is treated the same as StaticColor, except the red,
  1410.  
  1411.  
  1412.  
  1413. M.I.T.                                                         [Page 24]
  1414.  
  1415. RFC 1013                                                       June 1987
  1416.  
  1417.  
  1418.    green, and blue values are equal for any single pixel value,
  1419.    resulting in shades of gray.  StaticGray with a two-entry colormap
  1420.    can be thought of as "monochrome".
  1421.  
  1422.    The red-mask, green-mask, and blue-mask are only defined for
  1423.    DirectColor and TrueColor; each has one contiguous set of bits, with
  1424.    no intersections.
  1425.  
  1426.    The bits-per-rgb-value specifies the log base 2 of the approximate
  1427.    number of distinct color values (individually) of red, green, and
  1428.    blue. Actual RGB values are always passed in the protocol within a
  1429.    16-bit spectrum.
  1430.  
  1431.    The colormap-entries defines the number of available colormap entries
  1432.    in a newly created colormap.  For DirectColor and TrueColor, this
  1433.    will usually be the size of an individual pixel subfield.
  1434.  
  1435. SECTION 10.  REQUESTS
  1436.  
  1437.  
  1438. CreateWindow
  1439.            wid, parent: WINDOW
  1440.            class: {InputOutput, InputOnly, CopyFromParent}
  1441.            depth: CARD8
  1442.            visual: VISUALID or CopyFromParent
  1443.            x, y: INT16
  1444.            width, height, border-width: CARD16
  1445.            value-mask: BITMASK
  1446.            value-list: LISTofVALUE
  1447.  
  1448.            Errors: IDChoice, Window, Pixmap, Colormap, Cursor, Match,
  1449.            Value, Alloc
  1450.  
  1451.            Creates an unmapped window, and assigns the identifier wid
  1452.            to it.
  1453.  
  1454.            A class of CopyFromParent means the class is taken from the
  1455.            parent.  A depth of zero for class InputOutput or
  1456.            CopyFromParent means the depth is taken from the parent.
  1457.            A visual of CopyFromParent means the visual type is taken
  1458.            from the parent.  For class InputOutput, the visual type
  1459.            and depth must be a combination supported for the screen
  1460.            (else a Match error); the depth need not be the same as the
  1461.            parent, but the parent must not be of class InputOnly (else
  1462.            a Match error).  For class InputOnly, the depth must be
  1463.            zero (else a Match error), and the visual must be one
  1464.            supported for the screen (else a Match error), but the
  1465.            parent may have any depth and class.
  1466.  
  1467.            The server essentially acts as if InputOnly windows do not
  1468.            exist for the purposes of graphics requests, exposure
  1469.  
  1470.  
  1471.  
  1472. M.I.T.                                                         [Page 25]
  1473.  
  1474. RFC 1013                                                       June 1987
  1475.  
  1476.  
  1477.            processing, and VisibilityNotify events.  An InputOnly window
  1478.            cannot be used as a drawable (as a source or destination for
  1479.            graphics requests).  InputOnly and InputOutput windows act
  1480.            identically in other respects (properties, grabs, input
  1481.            control, and so on).
  1482.  
  1483.            The window is placed on top in the stacking order with
  1484.            respect to siblings.  The x and y coordinates are relative
  1485.            to the parent's origin, and specify the position of the upper
  1486.            left outer corner of the window (not the origin).  The width
  1487.            and height specify the inside size, not including the border,
  1488.            and must be non-zero.  The border-width for an InputOnly
  1489.            window must be zero (else a Match error).
  1490.  
  1491.            The value-mask and value-list specify attributes of the
  1492.            window that are to be explicitly initialized.  The possible
  1493.            values are:
  1494.  
  1495.                background-pixmap: PIXMAP or None or ParentRelative
  1496.                background-pixel: CARD32
  1497.                border-pixmap: PIXMAP or CopyFromParent
  1498.                border-pixel: CARD32
  1499.                bit-gravity: BITGRAVITY
  1500.                win-gravity: WINGRAVITY
  1501.                backing-store: {NotUseful, WhenMapped, Always}
  1502.                backing-bit-planes: CARD32
  1503.                backing-pixel: CARD32
  1504.                save-under: BOOL
  1505.                event-mask: SETofEVENT
  1506.                do-not-propagate-mask: SETofDEVICEEVENT
  1507.                override-redirect: BOOL
  1508.                colormap: COLORMAP or CopyFromParent
  1509.                cursor: CURSOR or None
  1510.  
  1511.            The default values, when attributes are not explicitly
  1512.            initialized, are:
  1513.  
  1514.                background-pixmap: None
  1515.                border-pixmap: CopyFromParent
  1516.                bit-gravity: Forget
  1517.                win-gravity: NorthWest
  1518.                backing-store: NotUseful
  1519.                backing-bit-planes: all ones
  1520.                backing-pixel: zero
  1521.                save-under: False
  1522.                event-mask: {} (empty set)
  1523.                do-not-propagate-mask: {} (empty set)
  1524.                override-redirect: False
  1525.                colormap: CopyFromParent
  1526.                cursor: None
  1527.  
  1528.  
  1529.  
  1530.  
  1531. M.I.T.                                                         [Page 26]
  1532.  
  1533. RFC 1013                                                       June 1987
  1534.  
  1535.  
  1536.            Only the following attributes are defined for InputOnly
  1537.            windows: win-gravity, event-mask, do-not-propagate-mask,
  1538.            and cursor.  It is a Match error to specify any other
  1539.            attributes for InputOnly windows.
  1540.  
  1541.            If background-pixmap is given, it overrides the default
  1542.            background-pixel.  The background pixmap and the window must
  1543.            have the same root and the same depth (else a Match error).
  1544.            Any size pixmap can be used, although some sizes may be
  1545.            faster than others.  If background None is specifed, the
  1546.            window has no defined background.  If background
  1547.            ParentRelative is specified, the parent's background is
  1548.            used, but the window must have the same depth as the parent
  1549.            (else a Match error); if the parent has background None,
  1550.            then the window will also have background None.  A copy
  1551.            of the parent's background is not made; the parent's
  1552.            background is reexamined each time the window background is
  1553.            required.  If background-pixel is given, it overrides the
  1554.            default and any background-pixmap given, and a pixmap of
  1555.            undefined size filled with background-pixel is used for the
  1556.            background.  For a  ParentRelative background, the
  1557.            background tile origin always aligns with the parent's
  1558.            background tile origin; otherwise the background tile
  1559.            origin is always the window origin.
  1560.  
  1561.            When regions of the window are exposed and the server has
  1562.            not retained the contents, the server automatically tiles
  1563.            the regions with the window's background unless the window
  1564.            has a background of None, in which case the previous screen
  1565.            contents are simply left in place. Exposure events are then
  1566.            generated for the regions, even if the  background is None.
  1567.  
  1568.            The border tile origin is always the same as the background
  1569.            tile origin.  If border-pixmap is given, it overrides the
  1570.            default border-pixel.  The border pixmap and the window must
  1571.            have the same root and the same depth (else a Match error).
  1572.            Any size pixmap can be used, although some sizes may faster
  1573.            than others.  If CopyFromParent is given, the parent's border
  1574.            pixmap is copied (subsequent changes to the parent do not
  1575.            affect the child), but the window must have the same depth
  1576.            as the parent (else a Match error).  If border-pixel is
  1577.            given, it overrides the default and any border-pixmap given,
  1578.            and a pixmap of undefined size filled with border-pixel is
  1579.            used for the border.
  1580.  
  1581.            Output to a window is always clipped to the inside of the
  1582.            window, so that the border is never affected.
  1583.  
  1584.            The bit-gravity defines which region of the window should be
  1585.            retained if the window is resized, and win-gravity defines
  1586.            how the window should be repositioned if the parent is
  1587.  
  1588.  
  1589.  
  1590. M.I.T.                                                         [Page 27]
  1591.  
  1592. RFC 1013                                                       June 1987
  1593.  
  1594.  
  1595.            resized; see ConfigureWindow.
  1596.  
  1597.            A backing-store of WhenMapped advises the server that
  1598.            maintaining contents of obscured regions when the window
  1599.            is mapped would be beneficial.  A backing-store of Always
  1600.            advises the server that maintaining contents even when the
  1601.            window is unmapped would be beneficial.  Note that, even if
  1602.            the window is larger than its parent, the server should
  1603.            maintain complete contents, not just the region within the
  1604.            parent boundaries.  If the server maintains contents,
  1605.            Exposure events will not be generated, but the server may
  1606.            stop maintaining contents at any time.  A value of NotUseful
  1607.            advises the server that maintaining contents is unnecessary,
  1608.            although a server may still choose to maintain contents.
  1609.  
  1610.            Backing-bit-planes indicates (with one bits) which bit
  1611.            planes of the window hold dynamic data that must be preserved
  1612.            in backing-stores. Backing-pixel specifies what value to use
  1613.            in planes not covered by backing-bit-planes.  The server is
  1614.            free to only save the specified bit planes in the
  1615.            backing-store, and regenerate the remaining planes with the
  1616.            specified pixel value.
  1617.  
  1618.            If save-under is True, the server is advised that, when
  1619.            this window is mapped, saving the contents of windows it
  1620.            obscures would be beneficial.
  1621.  
  1622.            The event-mask defines which events the client is interested
  1623.            in for this window (or, for some event types, inferiors of
  1624.            the window).  The do-not-propagate-mask defines which events
  1625.            should not be propagated to ancestor windows when no client
  1626.            has the event type selected in this window.
  1627.  
  1628.            Override-redirect specifies whether map and configure
  1629.            request on this window should override a SubstructureRedirect
  1630.            on the parent, typically to inform a window manager not to
  1631.            tamper with the window.
  1632.  
  1633.            The colormap specifies the colormap, that best reflects the
  1634.            "true" colors of the window.  Servers capable of supporting
  1635.            hardware colormaps may use this information, and window
  1636.            managers may use it for InstallColormap requests.  The
  1637.            colormap must have the same visual type as the window
  1638.            (else a match error). If CopyFromParent is specified, the
  1639.            parents's colormap is copied (subsequent changes to the
  1640.            parent do not affect the child), but the window must have
  1641.            the same visual type as the parent (else a Match error) an
  1642.            the parent must not have a colormap of None (else a Match
  1643.            error).
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649. M.I.T.                                                         [Page 28]
  1650.  
  1651. RFC 1013                                                       June 1987
  1652.  
  1653.  
  1654.            If a cursor is specified, it will be used whenever the
  1655.            pointer is in the window.  If None is specified, the
  1656.            parent's cursor will be used when the pointer is in the
  1657.            window, and any change in the parent's cursor will
  1658.            cause an immediate change in the display cursor.
  1659.  
  1660.            This request generates a CreateNotify event.
  1661.  
  1662.            The background and border pixmaps and the cursor may be
  1663.            freed immediately if no further explicit references to
  1664.            them are to be made.
  1665.  
  1666.            Subsequent drawing into the background or border pixmap has
  1667.            an undefined effect on the window state; the server might or
  1668.            might not make a copy of the pixmap.
  1669.  
  1670. ChangeWindowAttributes
  1671.           window: WINDOW
  1672.           value-mask: BITMASK
  1673.           value-list: LISTofVALUE
  1674.  
  1675.           Errors: Window, Pixmap, Colormap, Cursor, Match, Value,
  1676.                   Access
  1677.  
  1678.           The value-mask and value-list specify which attributes are
  1679.           to be changed.  The values and restrictions are the same
  1680.           as for CreateWindow.
  1681.  
  1682.           Changing the background does not cause the window contents
  1683.           to be changed.  Setting the border, or changing the
  1684.           background such that border tile origin changes, causes the
  1685.           border to be repainted. Changing the background of a root
  1686.           window to None or ParentRelative restores the default
  1687.           background pixmap. Changing the border of a root window to
  1688.           CopyFromParent restores the default border pixmap.
  1689.  
  1690.            Changing the back-store of an obsecured window to
  1691.            WhenMapped or Always, or changing the backing-bit-planes,
  1692.            backing-pixel, or save-under of a mapped window, may have
  1693.            no immediate effect.
  1694.  
  1695.            Multiple clients can select input on the same window; their
  1696.            event-masks are disjoint.  When an event is generated it
  1697.            will be reported to all interested clients.  However, at
  1698.            most one client at a time can select for
  1699.            SubstructureRedirect, at most one client at a time can
  1700.            select for ResizeRedirectr, and at most one client at a
  1701.            time can select for ButtonPress.
  1702.  
  1703.            There is only one do-not-propagate-mask for a window, not
  1704.            one per client.
  1705.  
  1706.  
  1707.  
  1708. M.I.T.                                                         [Page 29]
  1709.  
  1710. RFC 1013                                                       June 1987
  1711.  
  1712.  
  1713.            Changing the colormap of a window (i.e., defining a new map,
  1714.            not changing the contents of the existing map) generates a
  1715.            ColormapNorify event.  Changing the colormap os a visible
  1716.            window may have no immediate effect on the screen; see
  1717.            InstallColormap.
  1718.  
  1719.            Changing the cursor of a root window to None restores the
  1720.            default cursor.
  1721.  
  1722.            The order in which attributes are verified and altered is
  1723.            server dependent. If an error is generated, a subset of
  1724.            the attributes may have been altered.
  1725.  
  1726. GetWindowAttributes
  1727.            window: WINDOW
  1728.        =>
  1729.            visual: VISUALID
  1730.            class: {InputOutput, InputOnly}
  1731.            bit-gravity: BITGRAVITY
  1732.            win-gravity: WINGRAVITY
  1733.            backing-store: {NotUseful, WhenMapped, Always}
  1734.            backing-bit-planes: CARD32
  1735.            backing-pixel: CARD32
  1736.            save-under: BOOL
  1737.            colormap: COLORMAP or None
  1738.            map-is-installed: BOOL
  1739.            map-state: {Unmapped, Unviewable, Viewable}
  1740.            all-event-masks, your-event-mask: SETofEVENT
  1741.            do-not-propagate-mask: SETofDEVICEEVENT
  1742.            override-redirect: BOOL
  1743.  
  1744.            Errors: Window
  1745.  
  1746.            Returns current attributes of the window.  All-event-masks
  1747.            is the inclusive-OR of all event masks selected on the
  1748.            window by clients.  Your-event-mask is the event mask
  1749.            selected by the querying client.
  1750.  
  1751. DestroyWindow
  1752.            window: WINDOW
  1753.  
  1754.            Errors: Window
  1755.  
  1756.            If the argument window is mapped, an UnmapWindow request is
  1757.            performed automatically.  The window and all inferiors are
  1758.            then destroyed, and a DestroyNotify event is generated for
  1759.            each window, in order from the argument window downwards,
  1760.            with unspecified order among siblings at each level.
  1761.  
  1762.            Normal exposure processing on formerly obscured windows is
  1763.            performed.
  1764.  
  1765.  
  1766.  
  1767. M.I.T.                                                         [Page 30]
  1768.  
  1769. RFC 1013                                                       June 1987
  1770.  
  1771.  
  1772.            If the window is a root window, this request has no effect.
  1773.  
  1774. DestroySubwindows
  1775.            window: WINDOW
  1776.  
  1777.            Errors: Window
  1778.  
  1779.            Performs a DestroyWindow on all children of the window, in
  1780.            bottom to top stacking order.
  1781.  
  1782. ChangeSaveSet
  1783.            window: WINDOW
  1784.            mode: {Insert, Delete}
  1785.  
  1786.            Errors: Window, Match, Value
  1787.  
  1788.            Adds or removes the specified window from the client's
  1789.            "save-set".  The window must have been created by some other
  1790.            client (else a Match error).  The use of the save-set is
  1791.            described in Section 11.
  1792.  
  1793.            Windows are removed automatically from the save-set by the
  1794.            server when they are destroyed.
  1795.  
  1796. ReparentWindow
  1797.            window, parent: WINDOW
  1798.            x, y: INT16
  1799.  
  1800.            Errors: Window, Match
  1801.  
  1802.            If the window is mapped, an UnmapWindow request is
  1803.            performed automatically first.  The window is then removed
  1804.            from its current position in the hierarchy, and is inserted
  1805.            as a child of the specified parent.  The x and y coordinates
  1806.            are relative to the parent's origin, and specify the new
  1807.            position of the upper left outer corner of the window.  The
  1808.            window is placed on top in the stacking order with respect
  1809.            to siblings.  A ReparentNotify event is then generated.  The
  1810.            override-redirect attribute of the window is passed on in
  1811.            this event; a value of True indicates that a window manager
  1812.            should not tamper with this window.  Finally, if the window
  1813.            was originally mapped, a MapWindow request is performed
  1814.            automatically.
  1815.  
  1816.            Normal exposure processing on formerly obscured windows is
  1817.            performed. The server might not generate exposure events for
  1818.            regions from the initial unmap that are immediately obscured
  1819.            by the final map.
  1820.  
  1821.            A Match error is generated if the new parent is not on the
  1822.            same screen as the old parent, or if the new parent is the
  1823.  
  1824.  
  1825.  
  1826. M.I.T.                                                         [Page 31]
  1827.  
  1828. RFC 1013                                                       June 1987
  1829.  
  1830.  
  1831.            window itself or an inferior of the window, or if the window
  1832.            has a ParentRelative background and the new parent is not
  1833.            the same depth as the window.
  1834.  
  1835. MapWindow
  1836.            window: WINDOW
  1837.  
  1838.            Errors: Window
  1839.  
  1840.            If the window is already mapped, this request has no effect.
  1841.  
  1842.            If the override-redirect attribute of the window is False and
  1843.            some other client has selected SubstructureRedirect on the
  1844.            parent, then a MapRequest event is generated, but the window
  1845.            remains unmapped. Otherwise, the window is mapped and a
  1846.            MapNotify event is generated.
  1847.  
  1848.            If the window is now viewable and its contents had been
  1849.            discarded, then the window is tiled with its background (if
  1850.            no background is defined the existing screen contents are not
  1851.            altered) and one or more exposure events are generated.  If a
  1852.            backing-store has been maintained while the window was
  1853.            unmapped, no exposure events are generated. If a
  1854.            backing-store will now be maintained, a full-window exposure
  1855.            is always generated; otherwise only visible regions may be
  1856.            reported. Similar tiling and exposure take place for any
  1857.            newly viewable inferiors.
  1858.  
  1859. MapSubwindows
  1860.            window: WINDOW
  1861.  
  1862.            Errors: Window
  1863.  
  1864.            Performs a MapWindow request on all unmapped children of the
  1865.            window, in top to bottom stacking order.
  1866.  
  1867. UnmapWindow
  1868.            window: WINDOW
  1869.  
  1870.            Errors: Window
  1871.  
  1872.            If the window is already unmapped, this request has no
  1873.            effect. Otherwise, the window is unmapped and an UnmapNotify
  1874.            event is generated.  Normal exposure processing on formerly
  1875.            obscured windows is performed.
  1876.  
  1877. UnmapSubwindows
  1878.            window: WINDOW
  1879.  
  1880.            Errors: Window
  1881.  
  1882.  
  1883.  
  1884.  
  1885. M.I.T.                                                         [Page 32]
  1886.  
  1887. RFC 1013                                                       June 1987
  1888.  
  1889.  
  1890.            Performs an UnmapWindow request on all mapped children of the
  1891.            window, in bottom to top stacking order.
  1892.  
  1893. ConfigureWindow
  1894.            window: WINDOW
  1895.            value-mask: BITMASK
  1896.            value-list: LISTofVALUE
  1897.  
  1898.            Errors: Window, Match, Value
  1899.  
  1900.            Changes the configuration of the window.  The value-mask and
  1901.            value-list specify which values are to be given.  The
  1902.            possible values are:
  1903.  
  1904.                x: INT16
  1905.                y: INT16
  1906.                width: CARD16
  1907.                height: CARD16
  1908.                border-width: CARD16
  1909.                sibling: WINDOW
  1910.                stack-mode: {Above, Below, TopIf, BottomIf, Opposite}
  1911.  
  1912.            The x and y coordinates are relative to the parent's origin,
  1913.            and specify the position of the upper left outer corner of
  1914.            the window. The width and height specify the inside size,
  1915.            not including the border, and must be non-zero.  It is a
  1916.            Match error to attempt to make the border-width of an
  1917.            InputOnly window non-zero.
  1918.  
  1919.            If the override-redirect attribute of the window is False
  1920.            and some other client has selected SubstructureRedirect on
  1921.            the parent, then a ConfigureRequest event is generated, and
  1922.            no further processing is performed.  Otherwise, the following
  1923.            is performed.
  1924.  
  1925.            If some other client has selected ResizeRedirect on the
  1926.            window and the width or height of the window is being
  1927.            changed, then a ResizeRequest event is generated, and the
  1928.            current width and height are used instead in the following.
  1929.  
  1930.            The geometry of the window is changed as specified and the
  1931.            window is restacked among siblings as described below, and a
  1932.            ConfigureNotify event is generated.  If the width or height
  1933.            of the window has actually changed, then children of the
  1934.            window are affected as described below.
  1935.  
  1936.            Exposure processing is performed on formerly obscured
  1937.            windows.
  1938.  
  1939.            Changing the width or height of the window causes its
  1940.            contents to be moved or lost, depending on the bit-gravity of
  1941.  
  1942.  
  1943.  
  1944. M.I.T.                                                         [Page 33]
  1945.  
  1946. RFC 1013                                                       June 1987
  1947.  
  1948.  
  1949.            the window, and causes children to be reconfigured, depending
  1950.            on their win-gravity.  For a change of width and height of W
  1951.            and H, we define the [x, y] pairs:
  1952.  
  1953.                NorthWest: [0, 0]
  1954.                North: [W/2, 0]
  1955.                NorthEast: [W, 0]
  1956.                West: [0, H/2]
  1957.                Center: [W/2, H/2]
  1958.                East: [W, H/2]
  1959.                SouthWest: [0, H]
  1960.                South: [W/2, H]
  1961.                SouthEast: [W, H]
  1962.  
  1963.            When a window with one of these bit-gravities is resized, the
  1964.            corresponding pair defines the change in position of each
  1965.            pixel in the window.  When a window with one of these
  1966.            win-gravities has its parent window resized, the
  1967.            corresponding pair defines the change in position of the
  1968.            window within the parent.  When a window is so repositioned,
  1969.            a GravityNotify event is generated.
  1970.  
  1971.            A gravity of Static indicates that the contents or origin
  1972.            should not move relative to the origin of the root window. If
  1973.            the change in size of the window is coupled with a change in
  1974.            position of [X, Y], then for bit-gravity the change in
  1975.            position of each pixel is [-X, -Y], and for win-gravity the
  1976.            change in position of a child when its parent is so resized
  1977.            is [-X, -Y].  Note that Static gravity still only takes
  1978.            effect when the width or height of the window is changed, not
  1979.            when the window is simply moved.
  1980.  
  1981.            A bit-gravity of Forget indicates that the window contents
  1982.            are always discarded after a size change; the window is tiled
  1983.            with its background (if no background is defined, the
  1984.            existing screen contents are not altered) and one or more
  1985.            exposure events are generated.  A server may also ignore the
  1986.            specified bit-gravity and use Forget instead.
  1987.  
  1988.            A win-gravity of Unmap is like NorthWest, but the child is
  1989.            also unmapped when the parent is resized, and an UnmapNotify
  1990.            event is generated.
  1991.  
  1992.            If a sibling and a stack-mode is specified, the window is
  1993.            restacked as follows:
  1994.  
  1995.                Above:  window is placed just above sibling
  1996.                Below:  window is placed just below sibling
  1997.                TopIf:  if sibling occludes window, then window is placed
  1998.                        at the top of the stack
  1999.                BottomIf:  if window occludes sibling, then window is
  2000.  
  2001.  
  2002.  
  2003. M.I.T.                                                         [Page 34]
  2004.  
  2005. RFC 1013                                                       June 1987
  2006.  
  2007.  
  2008.                           placed at the bottom of the stack
  2009.                Opposite:  if sibling occludes window, then window is
  2010.                           placed at the top of the stack, else if window
  2011.                           occludes sibling, then window is placed at the
  2012.                           bottom of the stack
  2013.  
  2014.            If a stack-mode is specified but no sibling is specified, the
  2015.            window is restacked as follows:
  2016.  
  2017.                Above:  window is placed at the top of the stack
  2018.                Below:  window is placed at the bottom of the stack
  2019.                TopIf:  if any sibling occludes window, then window is
  2020.                        placed at the top of the stack
  2021.                BottomIf: if window occludes any sibling, then window is
  2022.                          placed at the bottom of the stack
  2023.                Opposite: if any sibling occludes window, then window is
  2024.                          placed at the top of the stack, else if window
  2025.                          occludes any sibling, then window is placed at
  2026.                          the bottom of the stack
  2027.  
  2028.            It is a Match error if a sibling is specified without a
  2029.            stack-mode, or if the window is not actually a sibling.
  2030.  
  2031.            Note that the computations for BottomIf, TopIf, and Opposite
  2032.            are performed with respect to the window's final geometry
  2033.            (as controlled by the other arguments to the request), not
  2034.            its initial geometry.
  2035.  
  2036. CirculateWindow
  2037.            window: WINDOW
  2038.            direction: {RaiseLowest, LowerHighest}
  2039.  
  2040.            Errors: Window, Value
  2041.  
  2042.            If some other client has selected SubstructureRedirect on the
  2043.            window, then a CirculateRequest event is generated, and no
  2044.            further processing is performed.  Otherwise, the following is
  2045.            performed, and then a CirculateNotify event is generated if
  2046.            the window is actually restacked.
  2047.  
  2048.            For RaiseLowest, raises the lowest mapped child (if any) that
  2049.            is occluded by another child to the top of the stack.  For
  2050.            LowerHighest, lowers the highest mapped child (if any) that
  2051.            occludes another child to the bottom of the stack.  Exposure
  2052.            processing is performed on formerly obscured windows.
  2053.  
  2054. GetGeometry
  2055.            drawable: DRAWABLE
  2056.        =>
  2057.            root: WINDOW
  2058.            depth: CARD8
  2059.  
  2060.  
  2061.  
  2062. M.I.T.                                                         [Page 35]
  2063.  
  2064. RFC 1013                                                       June 1987
  2065.  
  2066.  
  2067.            x, y: INT16
  2068.            width, height, border-width: CARD16
  2069.  
  2070.            Errors: Drawable
  2071.  
  2072.            Returns the root and (current) geometry of the drawable.
  2073.            Depth is the number of bits per pixel for the object.
  2074.            X, y, and border-width will always be zero for pixmaps.
  2075.            For a window, the x and y coordinates specify the upper
  2076.            left outer corner of the window relative to its parent's
  2077.            origin, and the width and height specify the inside size
  2078.            (not including the border).
  2079.  
  2080.            It is legal to pass an InputOnly window as a drawable to
  2081.            this request.
  2082.  
  2083. QueryTree
  2084.            window: WINDOW
  2085.        =>
  2086.            root: WINDOW
  2087.            parent: WINDOW or None
  2088.            children: LISTofWINDOW
  2089.  
  2090.            Errors: Window
  2091.  
  2092.            Returns the root, the parent, and children of the window.
  2093.            The children are listed in bottom-to-top stacking order.
  2094.  
  2095. InternAtom
  2096.            name: STRING8
  2097.            only-if-exists: BOOL
  2098.        =>
  2099.            atom: ATOM or None
  2100.  
  2101.            Errors: Value, Alloc
  2102.  
  2103.            Returns the atom for the given name.  If only-if-exists is
  2104.            False, then the atom is created if it does not exist.  The
  2105.            string should use the ASCII encoding, and upper/lower case
  2106.            matters.
  2107.  
  2108.            The lifetime of an atom is not tied to the interning client.
  2109.            Atoms remained defined until server reset (see Section 11).
  2110.  
  2111. GetAtomName
  2112.            atom: ATOM
  2113.        =>
  2114.            name: STRING8
  2115.  
  2116.            Errors: Atom
  2117.  
  2118.  
  2119.  
  2120.  
  2121. M.I.T.                                                         [Page 36]
  2122.  
  2123. RFC 1013                                                       June 1987
  2124.  
  2125.  
  2126.            Returns the name for the given atom.
  2127.  
  2128. ChangeProperty
  2129.            window: WINDOW
  2130.            property, type: ATOM
  2131.            format: {8, 16, 32}
  2132.            mode: {Replace, Prepend, Append}
  2133.            data: LISTofINT8 or LISTofINT16 or LISTofINT32
  2134.  
  2135.            Errors: Window, Atom, Value, Match, Alloc
  2136.  
  2137.            Alters the property for the specified window.  The type is
  2138.            uninterpreted by the server.  The format specifies whether
  2139.            the data should be viewed as a list of 8-bit, 16-bit, or
  2140.            32-bit quantities, so that the server can correctly
  2141.            byte-swap as necessary.
  2142.  
  2143.            If mode is Replace, the previous property value is discarded.
  2144.            If the mode is Prepend or Append, then the type and format
  2145.            must match the existing property value (else a Match error);
  2146.            if the property is undefined, it is treated as defined with
  2147.            the correct type and format with zero-length data.  For
  2148.            Prepend, the data is tacked on to the beginning of the
  2149.            existing data, and for Append it is tacked on to the
  2150.            end of the existing data.
  2151.  
  2152.            Generates a PropertyNotify event on the window.
  2153.  
  2154.            The lifetime of a property is not tied to the storing client.
  2155.            Properties remain until explicitly deleted, or the window is
  2156.            destroyed, or until server reset (see Section 11).
  2157.  
  2158.            The maximum size of a property is server dependent.
  2159.  
  2160. DeleteProperty
  2161.            window: WINDOW
  2162.            property: ATOM
  2163.  
  2164.            Errors: Window, Atom
  2165.  
  2166.            Deletes the property from the specified window if the
  2167.            property exists. Generates a PropertyNotify event on the
  2168.            window unless the property does not exist.
  2169.  
  2170. GetProperty
  2171.            window: WINDOW
  2172.            property: ATOM
  2173.            type: ATOM or AnyPropertyType
  2174.            long-offset, long-length: CARD32
  2175.            delete: BOOL
  2176.        =>
  2177.  
  2178.  
  2179.  
  2180. M.I.T.                                                         [Page 37]
  2181.  
  2182. RFC 1013                                                       June 1987
  2183.  
  2184.  
  2185.            type: ATOM
  2186.            format: {8, 16, 32}
  2187.            bytes-after: CARD32
  2188.            value: LISTofINT8 or LISTofINT16 or LISTofINT32
  2189.  
  2190.            Errors: Window, Atom, Property, Match, Value
  2191.  
  2192.            If the specified property does not exist for the specifed
  2193.            window, a Property error is generated.  Otherwise, if type
  2194.            AnyPropertyType is specified, (part of) the property is
  2195.            returned regardless of its type; if a type is specified,
  2196.            (part of) the property is returned only if its type equals
  2197.            the specified type (else a Match error).  The actual type
  2198.            and format of the property are returned.
  2199.  
  2200.            Define the following values:
  2201.                    N = actual length of the stored property in bytes
  2202.                        (even if the format is 16 or 32)
  2203.                    I = 4 * long-offset
  2204.                    T = N - I
  2205.                    L = MINIMUM(T, 4 * long-length)
  2206.                    A = N - (I + L)
  2207.            The returned value starts at byte index I in the property
  2208.            (indexing from 0), and its length in bytes is L.  It is a
  2209.            Value error if long-offset is given such that L is negative.
  2210.            The value of bytes-after is A, giving the number of trailing
  2211.            unread bytes in the stored property.
  2212.  
  2213.            If delete is True and bytes-after is zero, the property is
  2214.            also deleted from the window and a PropertyNotify event is
  2215.            generated on the window.
  2216.  
  2217. RotateProperties
  2218.            window: WINDOW
  2219.            delta: INT8
  2220.            properties: LISTofATOM
  2221.  
  2222.            Errors: Window, Atom, Match
  2223.  
  2224.            If the property names in the list are viewed as being
  2225.            numbered starting from zero, and there are N property names
  2226.            in the list, then the value associated with property name I
  2227.            becomes the value associated with property name (I + delta)
  2228.            mod N, for all I from zero to N - 1.  The effect is to rotate
  2229.            the states by delta places around the virtual ring of
  2230.            property names (right for positive delta, left for negative
  2231.            delta).
  2232.  
  2233.            A PropertyNotify event is generated for each property, in the
  2234.            order listed.
  2235.  
  2236.  
  2237.  
  2238.  
  2239. M.I.T.                                                         [Page 38]
  2240.  
  2241. RFC 1013                                                       June 1987
  2242.  
  2243.  
  2244.            If an atom occurs more than once in the list or no property
  2245.            with that name is defined for the window, a Match error is
  2246.            generated.  If an Atom or Match error is generated, no
  2247.            properties are changed.
  2248.  
  2249. ListProperties
  2250.            window: WINDOW
  2251.        =>
  2252.            atoms: LISTofATOM
  2253.  
  2254.            Errors: Window
  2255.  
  2256.            Returns the atoms of properties currently defined on the
  2257.            window.
  2258.  
  2259. SetSelectionOwner
  2260.            selection: ATOM
  2261.            owner: WINDOW or None
  2262.            time: TIMESTAMP or CurrentTime
  2263.  
  2264.            Error: Atom, Window
  2265.  
  2266.            Changes the owner and last-change time of the specifed
  2267.            selection.  The request has no effect if the specified time
  2268.            is earlier than the current last-change time of the specified
  2269.            selection or is later than the current server time;
  2270.            otherwise, the last-change time is set to the specified time,
  2271.            with CurrentTime replaced by the current server time.
  2272.            If the new owner is not the same as the current owner of the
  2273.            selection, and the current owner is a window, then the
  2274.            current owner is sent a SelectClear event.
  2275.  
  2276.            If the owner of a selection is a window, and the window is
  2277.            later destroyed, the owner of the selection automatically
  2278.            reverts to None, but the last-change time is not affected.
  2279.  
  2280.            The selection atom is uninterpreted by the server.
  2281.  
  2282.            Selections are global to the server.
  2283.  
  2284. GetSelectionOwner
  2285.            selection: ATOM
  2286.        =>
  2287.            owner: WINDOW or None
  2288.  
  2289.            Errors: Atom
  2290.  
  2291.            Returns the current owner of the specified selection, if any.
  2292.  
  2293. ConvertSelection
  2294.            selection, target: ATOM
  2295.  
  2296.  
  2297.  
  2298. M.I.T.                                                         [Page 39]
  2299.  
  2300. RFC 1013                                                       June 1987
  2301.  
  2302.  
  2303.            property: ATOM or None
  2304.            requestor: WINDOW
  2305.            time: TIMESTAMP or CurrentTime
  2306.  
  2307.            Error: Atom, Window
  2308.  
  2309.            If the specified selection is owned by a window, the server
  2310.            sends a SelectionRequest event to the owner.  If no owner for
  2311.            the specified selection exists, the server generates a
  2312.            SelectionNotify event to the requestor with property None.
  2313.            The arguments are passed on unchanged in either event.
  2314.  
  2315. SendEvent
  2316.            destination: WINDOW or PointerWindow or InputFocus
  2317.            propagate: BOOL
  2318.            event-mask: SETofEVENT
  2319.            event: <normal-event-format>
  2320.  
  2321.            Errors: Window, Value
  2322.  
  2323.            If PointerWindow is specified, destination is replaced with
  2324.            the window that the pointer is in.  If InputFocus is
  2325.            specified, then if the focus window contains the pointer,
  2326.            destination is replaced with the window that the pointer is
  2327.            in, and otherwise destination is replaced with the focus
  2328.            window.
  2329.  
  2330.            If propagate is False, then the event is sent to every client
  2331.            selecting on destination any of the event types in
  2332.            event-mask.
  2333.  
  2334.            If propagate is True and no clients have selected on
  2335.            destination any of the event types in event-mask, then
  2336.            destination is replaced with the closest ancestor of
  2337.            destination for which some client has selected a type in
  2338.            event-mask and no intervening window has that type in its
  2339.            do-not-propagate-mask.  If no such window exists, or if the
  2340.            window is an ancestor of the focus window and InputFocus was
  2341.            originally specified sent to any clients. Otherwise, the
  2342.            event is reported to every client selecting on the final
  2343.            destination any of the types specified in event-mask.
  2344.  
  2345.            The event code must be one of the core events, or one of
  2346.            the events defined by an extension, so that the server can
  2347.            correctly byte swap the contents as necessary.  The
  2348.            contents of the event are otherwise unaltered and unchecked
  2349.            by the server except to force on the most significant bit
  2350.            of the event code.
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357. M.I.T.                                                         [Page 40]
  2358.  
  2359. RFC 1013                                                       June 1987
  2360.  
  2361.  
  2362.            Active grabs are ignored for this request.
  2363.  
  2364. GrabPointer
  2365.            grab-window: WINDOW
  2366.            owner-events: BOOL
  2367.            event-mask: SETofPOINTEREVENT
  2368.            pointer-mode, keyboard-mode: {Synchronous, Asynchronous}
  2369.            confine-to: WINDOW or None
  2370.            cursor: CURSOR or None
  2371.            time: TIMESTAMP or CurrentTime
  2372.        =>
  2373.            status: {Success, AlreadyGrabbed, Frozen, InvalidTime,
  2374.                     NotViewable}
  2375.  
  2376.            Errors: Cursor, Window, Value
  2377.  
  2378.            Actively grabs control of the pointer.  Further pointer
  2379.            events are only reported to the grabbing client.  The
  2380.            request overrides any active pointer grab by this client.
  2381.  
  2382.            Event-mask is always augmented to include ButtonPress and
  2383.            ButtonRelease.  If owner-events is False, all generated
  2384.            pointer events are reported with respect to grab-window,
  2385.            and are only reported if selected by event-mask.  If
  2386.            owner-events is True, then if a generated pointer event
  2387.            would normally be reported to this client, it is reported
  2388.            normally; otherwise the event is reported with respect to
  2389.            the grab-window, and is only reported if selected by
  2390.            event-mask.  For either value of owner-events, unreported
  2391.            events are simply discarded.
  2392.  
  2393.            Pointer-mode controls further processing of pointer events,
  2394.            and keyboard-mode controls further processing of keyboard
  2395.            events.  If the mode is Asynchronous, event processing
  2396.            continues normally; if the device is currently frozen by
  2397.            this client, then processing of events for the device is
  2398.            resumed.  If the mode is Synchronous, the device (as seen
  2399.            via the protocol) appears to freeze, and no further events
  2400.            for that device are generated by the server until the
  2401.            grabbing client issues a releasing AllowEvents request.
  2402.            Actual device changes are not lost while the device is
  2403.            frozen; they are simply queued for later processing.
  2404.  
  2405.            If a cursor is specified, then it is displayed regardless
  2406.            of what window the pointer is in.  If no cursor is
  2407.            specified, then when the pointer is in grab-window or one
  2408.            of its subwindows, the normal cursor for that window is
  2409.            displayed, and otherwise the cursor for grab-window is
  2410.            displayed.
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416. M.I.T.                                                         [Page 41]
  2417.  
  2418. RFC 1013                                                       June 1987
  2419.  
  2420.  
  2421.            If a confine-to window is specified, then the pointer
  2422.            will be restricted to stay contained in that window.
  2423.            The confine-to  window need have no relationship to the
  2424.            grab-window.  If the pointer is not initially in the
  2425.            confine-to window, then it is warped automatically to
  2426.            the closest edge (and enter/leave events generated
  2427.            normally) just  before the grab activates.  If the
  2428.            confine-to window is subsequently reconfigured, the
  2429.            pointer will be warped automatically as necessary to keep
  2430.            it contained in the window.
  2431.  
  2432.            This request generates EnterNotify and LeaveNotify events.
  2433.  
  2434.            The request fails with status AlreadyGrabbed if the
  2435.            pointer is actively grabbed by some other client.  The
  2436.            request fails with status Frozen if the pointer is frozen
  2437.            by an active grab of another client.  The request fails
  2438.            with status NotViewable if grab-window or
  2439.            confine-to window is not viewable.  The request fails with
  2440.            status InvalidTime if the specified time is earlier than
  2441.            the last-pointer-grab time or later than the current
  2442.            server time; otherwise the last-pointer-grab time is set
  2443.            to the specified time, with CurrentTime replaced by the
  2444.            current server time.
  2445.  
  2446. UngrabPointer
  2447.            time: TIMESTAMP or CurrentTime
  2448.  
  2449.            Releases the pointer if this client has it actively
  2450.            grabbed (from either GrabPointer or GrabButton or from a
  2451.            normal button press), and releases any queued events. The
  2452.            request has no effect if the specified time is earlier
  2453.            than the last-pointer-grab time or is later than the
  2454.            current server time.
  2455.  
  2456.            This request generates EnterNotify and LeaveNotify events.
  2457.  
  2458.            An UngrabPointer is performed automatically if the event
  2459.            window or confine-to window for an active pointer grab
  2460.            becomes not viewable.
  2461.  
  2462. GrabButton
  2463.            modifiers: SETofKEYMASK or AnyModifier
  2464.            button: BUTTON or AnyButton
  2465.            grab-window: WINDOW
  2466.            owner-events: BOOL
  2467.            event-mask: SETofPOINTEREVENT
  2468.            pointer-mode, keyboard-mode: {Synchronous, Asynchronous}
  2469.            confine-to: WINDOW or None
  2470.            cursor: CURSOR or None
  2471.  
  2472.  
  2473.  
  2474.  
  2475. M.I.T.                                                         [Page 42]
  2476.  
  2477. RFC 1013                                                       June 1987
  2478.  
  2479.  
  2480.            Errors: Cursor, Window, Value, Access
  2481.  
  2482.            This request establishes a passive grab.  In the future,
  2483.            if the specified button is pressed when the specified
  2484.            modifier keys are down (and no other buttons or modifier
  2485.            keys are down), and grab-window contains the pointer,
  2486.            and the confine-to window (if any) is viewable, and these
  2487.            constraints are not satisfied for any ancestor, then the
  2488.            pointer is actively grabbed as described in GrabPointer,
  2489.            the last-pointer-grab time is set to the time at which
  2490.            the button was pressed (as transmitted in the ButtonPress
  2491.            event), and the ButtonPress event is reported.  The
  2492.            interpretation of the remaining arguments is as for
  2493.            GrabPointer.  The active grab is terminated automatically
  2494.            when all buttons are released (independent of the state
  2495.            of modifier keys).
  2496.  
  2497.            A modifiers of AnyModifier is equivalent to issuing the
  2498.            request for all possible modifier combinations.  A
  2499.            button of AnyButton is equivalent to issuing the request
  2500.            for all possible buttons.
  2501.  
  2502.            An Access error is generated if some other client has
  2503.            already issued a GrabButton with the same button/key
  2504.            combination on the same window. When using AnyModifier
  2505.            or AnyButton, the request fails completely (no grabs are
  2506.            established) if there is a combination.  The request has
  2507.            no effect on an active grab.
  2508.  
  2509. UngrabButton
  2510.            modifiers: SETofKEYMASK or AnyModifier
  2511.            button: BUTTON or AnyButton
  2512.            grab-window: WINDOW
  2513.  
  2514.            Errors: Window
  2515.  
  2516.            Releases the passive button/key combination on the
  2517.            specified window if it was grabbed by this client. A
  2518.            modifiers of AnyModifier is equivalent to issuing the
  2519.            request for all possible modifier combinations.  A
  2520.            button of AnyButton is equivalent to issuing the request
  2521.            for all possible buttons. Has no effect on an active
  2522.            grab.
  2523.  
  2524. ChangeActivePointerGrab
  2525.            event-mask: SETofPOINTEREVENT
  2526.            cursor: CURSOR or None
  2527.            time: TIMESTAMP or CurrentTime
  2528.  
  2529.            Errors: Cursor
  2530.  
  2531.  
  2532.  
  2533.  
  2534. M.I.T.                                                         [Page 43]
  2535.  
  2536. RFC 1013                                                       June 1987
  2537.  
  2538.  
  2539.            Changes the specified dynamic parameters if the pointer
  2540.            is actively grabbed by the client and the specified time
  2541.            is no earlier than the last-pointer-grab time and no
  2542.            later than the current server time.  The interpretation
  2543.            of event-mask and cursor are as in GrabPointer.  The
  2544.            event-mask is always augmented to include ButtonPress
  2545.            and ButtonRelease.  Has no effect on the passive
  2546.            parameters of a GrabButton.
  2547.  
  2548. GrabKeyboard
  2549.            grab-window: WINDOW
  2550.            owner-events: BOOL
  2551.            pointer-mode, keyboard-mode: {Synchronous, Asynchronous}
  2552.            time: TIMESTAMP or CurrentTime
  2553.        =>
  2554.            status: {Success, AlreadyGrabbed, Frozen, InvalidTime,
  2555.                     NotViewable}
  2556.  
  2557.            Errors: Window, Value
  2558.  
  2559.            Actively grabs control of the keyboard.  Further key
  2560.            events are reported only to the grabbing client.  The
  2561.            request overrides any active keyboard grab by this
  2562.            client.
  2563.  
  2564.            If owner-events is False, all generated key events are
  2565.            reported with respect to grab-window.  If owner-events is
  2566.            True, then if a generated key event would normally be
  2567.            reported to this client, it is reported normally;
  2568.            otherwise the event is reported with respect to the
  2569.            grab-window.  Both KeyPress and KeyRelease events are
  2570.            always reported, independent of any event selection made
  2571.            by the client.
  2572.  
  2573.            Pointer-mode controls further processing of pointer
  2574.            events, and keyboard-mode controls further processing of
  2575.            keyboard events.  If the mode is Asynchronous, event
  2576.            processing continues normally; if the device is currently
  2577.            frozen by this client, then processing of events for the
  2578.            device is resumed.  If the mode is Synchronous, the
  2579.            device (as seen via the protocol) appears to freeze, and
  2580.            no further events for that device are generated by the
  2581.            server until the grabbing client issues a releasing
  2582.            AllowEvents request.  Actual device changes are not lost
  2583.            while the device is frozen; they are simply queued for
  2584.            later processing.
  2585.  
  2586.            This request generates FocusIn and FocusOut events.
  2587.  
  2588.            The request fails with status AlreadyGrabbed if the
  2589.            keyboard is actively grabbed by some other client.  The
  2590.  
  2591.  
  2592.  
  2593. M.I.T.                                                         [Page 44]
  2594.  
  2595. RFC 1013                                                       June 1987
  2596.  
  2597.  
  2598.            request fails with status Frozen if the keyboard is
  2599.            frozen by an active grab of another client. The request
  2600.            fails with status NotViewable if grab-window is not
  2601.            viewable.  The request fails with status InvalidTime if
  2602.            the specified time is earlier than the last-keyboard-grab
  2603.            time or later than the current server time; otherwise the
  2604.            last-keyboard-grab time is set to the specified time,
  2605.            with CurrentTime replaced by the current server time.
  2606.  
  2607. UngrabKeyboard
  2608.            time: TIMESTAMP or CurrentTime
  2609.  
  2610.            Releases the keyboard if this client has it actively
  2611.            grabbed (from either GrabKeyboard or GrabKey), and
  2612.            releases any queued events.  The request has no effect
  2613.            if the specified time is earlier than the
  2614.            last-keyboard-grab time or is later than the current
  2615.            server time.
  2616.  
  2617.            This request generates FocusIn and FocusOut events.
  2618.  
  2619.            An UngrabKeyboard is performed automatically if the event
  2620.            window for an active keyboard grab becomes not viewable.
  2621.  
  2622. GrabKey
  2623.            key: KEYCODE or AnyNonModifier
  2624.            modifiers: SETofKEYMASK or AnyModifier
  2625.            grab-window: WINDOW
  2626.            owner-events: BOOL
  2627.            pointer-mode, keyboard-mode: {Synchronous, Asynchronous}
  2628.  
  2629.            Errors: Window, Value, Access
  2630.  
  2631.            This request establishes a passive grab on the keyboard.
  2632.            In the future, if the specified key (which can itself be a
  2633.            modifier key) is pressed when the specified modifier keys
  2634.            are down (and no other modifier keys are down), and the
  2635.            KeyPress event would be generated in grab-window or one of
  2636.            its inferiors, and these constraints are not satisfied for
  2637.            any ancestor, then the keyboard is actively grabbed as
  2638.            described in GrabKeyboard, the last-keyboard-grab time is
  2639.            transmitted in set to the time at which the key was
  2640.            pressed (as in the KeyPress event), and the KeyPress
  2641.            event is reported.  The interpretation of the remaining
  2642.            arguments is as for GrabKeyboard.  The active grab is
  2643.            terminated automatically when the specified key has been
  2644.            released (independent of the state of the modifier keys).
  2645.  
  2646.            A modifiers of AnyModifier is equivalent to issuing the
  2647.            request for all possible modifier combinations.  A key of
  2648.            AnyNonModifier is equivalent to issuing the request for
  2649.  
  2650.  
  2651.  
  2652. M.I.T.                                                         [Page 45]
  2653.  
  2654. RFC 1013                                                       June 1987
  2655.  
  2656.  
  2657.            all possible non-modifier key codes.
  2658.  
  2659.            An Access error is generated if some other client has
  2660.            issued a GrabKey with the same key combination on the
  2661.            same window. When using AnyModifier or AnyNonModifier,
  2662.            the request fails  completely (no grabs are established)
  2663.            if there is a conflicting grab for any combination.
  2664.  
  2665. UngrabKey
  2666.            key: KEYCODE or AnyNonModifier
  2667.            modifiers: SETofKEYMASK or AnyModifier
  2668.            grab-window: WINDOW
  2669.  
  2670.            Errors: Window
  2671.  
  2672.            Releases the key combination on the specified window if it
  2673.            was grabbed by this client.  A modifiers of AnyModifier is
  2674.            equivalent to issuing the request for all possible
  2675.            modifier combinations.  A key of AnyNonModifier is
  2676.            equivalent to issuing the request for all possible
  2677.            non-modifier key codes.  Has no effect on an active grab.
  2678.  
  2679. AllowEvents
  2680.            mode: {AsyncPointer, SyncPointer, ReplayPointer,
  2681.                   AsyncKeyboard, SyncKeyboard, ReplayKeyboard}
  2682.            time: TIMESTAMP or CurrentTime
  2683.  
  2684.            Errors: Value
  2685.  
  2686.            Releases some queued events if the client has caused a
  2687.            device to freeze.  The request has no effect if the
  2688.            specified time is earlier than the last-grab time of the
  2689.            most recent active grab for the client, or if the
  2690.            specified time is later than the current server time.
  2691.  
  2692.            For AsyncPointer, if the pointer is frozen by the client,
  2693.            pointer event processing continues normally.  If the
  2694.            pointer is frozen twice by the client on behalf of two
  2695.            separate grabs, AsyncPointer "thaws" for both.
  2696.            AsyncPointer has no effect if the pointer is not frozen
  2697.            by the client, but the pointer need not be grabbed by
  2698.            the client.
  2699.  
  2700.            For SyncPointer, if the pointer is frozen and actively
  2701.            grabbed by the client, pointer event processing continues
  2702.            normally until the next ButtonPress or ButtonRelease event
  2703.            is reported to the client, at which time the pointer again
  2704.            appears to freeze.  However if the reported event causes
  2705.            the pointer grab to be released, then the pointer does not
  2706.            freeze.  SyncPointer has no effect if the pointer is not
  2707.            frozen by the client, or if the pointer is not grabbed by
  2708.  
  2709.  
  2710.  
  2711. M.I.T.                                                         [Page 46]
  2712.  
  2713. RFC 1013                                                       June 1987
  2714.  
  2715.  
  2716.            the client.
  2717.  
  2718.            For ReplayPointer, if the pointer is actively grabbed by
  2719.            the client and is frozen as the result of an event having
  2720.            been sent to the client (either from the activation of a
  2721.            GrabButton, or from a previous AllowEvents with mode
  2722.            SyncPointer, but not from a GrabPointer), then the pointer
  2723.            grab is released and that event is completely reprocessed,
  2724.            but this time ignoring any passive grabs at or above
  2725.            (towards the root) the grab-window of the grab just
  2726.            released.  The request has no effect if the pointer is
  2727.            not grabbed by the client, or if the pointer is not
  2728.            frozen as the result of an event.
  2729.  
  2730.            For AsyncKeyboard, if the keyboard is frozen by the
  2731.            client, keyboard event processing continues normally.  If
  2732.            the pointer is frozen twice by the client on behalf of
  2733.            two separate grabs, AsyncPointer "thaws" for both.
  2734.            AsyncKeyboard has no effect if the keyboard is not
  2735.            frozen by the client, but the keyboard need not be
  2736.            grabbed by the client.
  2737.  
  2738.            For SyncKeyboard, if the keyboard is frozen and actively
  2739.            grabbed by the client, keyboard event processing
  2740.            continues normally until the next KeyPress or KeyRelease
  2741.            event is  reported to the client, at which time the
  2742.            keyboard again appears to freeze.  However if the
  2743.            reported event causes the keyboard grab to be released,
  2744.            then the keyboard does not freeze.  SyncKeyboard has no
  2745.            effect if the keyboard is not frozen by the client, or
  2746.            if the keyboard is not grabbed by the client.
  2747.  
  2748.            For ReplayKeyboard, if the keyboard is actively grabbed
  2749.            by the client and is frozen as the result of an event
  2750.            having been sent to the client  (either from the
  2751.            activation of a GrabKey, or from a previous AllowEvents
  2752.            with mode SyncKeyboard, but not from a GrabKeyboard),
  2753.            then the keyboard grab is released and that event is
  2754.            completely reprocessed, but this time ignoring any passive
  2755.            grabs at or above (towards the root) the grab-window of
  2756.            the grab just released.  The request has no effect if the
  2757.            keyboard is not grabbed by the client, or if the keyboard
  2758.            is notfrozen as the result of an event.
  2759.  
  2760.            AsyncPointer, SyncPointer, and Replay Pointer have no
  2761.            effect on processing of keyboard events.  AsyncKeyboard,
  2762.            SyncKeyboard, and ReplayKeyboard have no effect on
  2763.            processing of pointer events.
  2764.  
  2765.            It is possible for both a pointer grab and a keyboard grab
  2766.            to be active simultaneously (by the same or different
  2767.  
  2768.  
  2769.  
  2770. M.I.T.                                                         [Page 47]
  2771.  
  2772. RFC 1013                                                       June 1987
  2773.  
  2774.  
  2775.            clients).  If a device is frozen on behalf of either grab,
  2776.            no event processing is performed for the device.  It is
  2777.            possible for a single device to be frozen due to both
  2778.            grabs.  In this case, the freeze must be released on
  2779.            behalf of both grabs before events can again be
  2780.            processed.
  2781.  
  2782. GrabServer
  2783.            Disables processing of requests and close-downs on all
  2784.            other connections (than the one this request arrived on).
  2785.  
  2786. UngrabServer
  2787.            Restarts processing of requests and close-downs on other
  2788.            connections.
  2789.  
  2790. QueryPointer
  2791.            window: WINDOW
  2792.        =>
  2793.            root: WINDOW
  2794.            child: WINDOW or None
  2795.            same-screen: BOOL
  2796.            root-x, root-y, win-x, win-y: INT16
  2797.            mask: SETofKEYBUTMASK
  2798.  
  2799.            Errors: Window
  2800.  
  2801.            The root window the pointer is currently on, and pointer
  2802.            coordinates relative to the root's origin, are returned.
  2803.            If same-screen is False, then the pointer is not on the
  2804.            same screen as the argument window, and child is None and
  2805.            win-x and win-y are zero.  If same-screen is True, then
  2806.            win-x and win-y are the pointer coordinates relative to
  2807.            the argument window's origin, and child is the child
  2808.            containing the pointer, if any.  The current state of the
  2809.            modifier keys and the buttons are also returned.
  2810.  
  2811. GetMotionEvents
  2812.            start, stop: TIMESTAMP or CurrentTime
  2813.            window: WINDOW
  2814.        =>
  2815.            events: LISTofTIMECOORD
  2816.  
  2817.            where
  2818.                    TIMECOORD: {x, y: CARD16
  2819.                                time: TIMESTAMP}
  2820.  
  2821.            Error: Window
  2822.  
  2823.            Returns all events in the motion history buffer that fall
  2824.            between the specified start and stop times (inclusive)
  2825.            and that have coordinates that lie within (including
  2826.  
  2827.  
  2828.  
  2829. M.I.T.                                                         [Page 48]
  2830.  
  2831. RFC 1013                                                       June 1987
  2832.  
  2833.  
  2834.            borders) the specified window at its present placement.
  2835.            The x and y coordinates are reported relative to the
  2836.            origin  of the window.
  2837.  
  2838. TranslateCoordinates
  2839.            src-window, dst-window: WINDOW
  2840.            src-x, src-y: INT16
  2841.        =>
  2842.            same-screen: BOOL
  2843.            child: WINDOW or None
  2844.            dst-x, dst-y: INT16
  2845.  
  2846.            Errors: Window
  2847.  
  2848.            The src-x and src-y coordinates are taken relative to
  2849.            src-window's origin, and returned as dst-x and dst-y
  2850.            coordinates relative to dst-window's origin.  If
  2851.            same-screen is False, then src-window and dst-window are
  2852.            on different screens, and dst-x and dst-y are zero.  If
  2853.            the coordinates are contained in a mapped child of
  2854.            dst-window, then that child is returned.
  2855.  
  2856. WarpPointer
  2857.            src-window: WINDOW or None
  2858.            dst-window: WINDOW
  2859.            src-x, src-y: INT16
  2860.            src-width, src-height: CARD16
  2861.            dst-x, dst-y: INT16
  2862.  
  2863.            Errors: Window
  2864.  
  2865.            Moves the pointer to [dst-x, dst-y] relative to
  2866.            dst-window's origin. If src-window is None, the move is
  2867.            independent of the current pointer position, but if a
  2868.            window is specified, the move only takes place if the
  2869.            pointer is currently contained in a visible portion of
  2870.            the specified rectangle of the src-window.
  2871.  
  2872.            The src-x and src-y coordinates are relative to
  2873.            src-window's origin.  If src-height is zero, it is
  2874.            replaced with the current height of src-window minus
  2875.            src-y.  If src-width is zero, it is replaced with the
  2876.            current width of src-window minus src-x.
  2877.  
  2878.            This request cannot be used to move the pointer outside
  2879.            the confine-to window of an active pointer grab; an
  2880.            attempt will only move the pointer as far as the closest
  2881.            edge of the confine-to window.
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888. M.I.T.                                                         [Page 49]
  2889.  
  2890. RFC 1013                                                       June 1987
  2891.  
  2892.  
  2893. SetInputFocus
  2894.            focus: WINDOW or PointerRoot or None
  2895.            revert-to: {Parent, PointerRoot, None}
  2896.            time: TIMESTAMP or CurrentTime
  2897.  
  2898.            Errors: Window, Value
  2899.  
  2900.            Changes the input focus and the last-focus-change time.
  2901.            The request has no effect if the specified time is earlier
  2902.            than the current last-focus-change time or is later than
  2903.            the current server time; otherwise, the last-focus-change
  2904.            time is set to the specified time, with CurrentTime
  2905.            replaced by the current server time.
  2906.  
  2907.            If None is specified as the focus, all keyboard events are
  2908.            discarded until a new focus window is set.  In this case,
  2909.            therevert-to argument is ignored.
  2910.  
  2911.            If a window is specified as the focus, it becomes the
  2912.            keyboard's focus window.  If a generated keyboard event
  2913.            would normally be reported to this window or one of its
  2914.            inferiors, the event is reported normally; otherwise, the
  2915.            event is reported with respect to the focus window.
  2916.  
  2917.            If PointerRoot is specified as the focus, the focus
  2918.            window is dynamically taken to be the root window of
  2919.            whatever screen the pointer is on at each keyboard event.
  2920.            In this case, the revert-to argument is ignored.
  2921.  
  2922.            This request generates FocusIn and FocusOut events.
  2923.  
  2924.            If the focus window becomes not viewable, the new focus
  2925.            window depends on the revert-to argument.  If revert-to
  2926.            is Parent, the focus reverts to the parent (or the
  2927.            closest viewable ancestor) and the new revert-to value is
  2928.            take to be None.  If revert-to is PointerRoot or None,
  2929.            the focus reverts to that value.  When the focus reverts,
  2930.            FocusIn and FocusOut events are generated, but the
  2931.            last-focus-change time is not affected.
  2932.  
  2933. GetInputFocus
  2934.            =>
  2935.            focus: WINDOW or PointerRoot or None
  2936.            revert-to: {Parent, PointerRoot, None}
  2937.  
  2938.            Returns the current focus state.
  2939.  
  2940. QueryKeymap
  2941.        =>
  2942.            keys: LISTofCARD8
  2943.  
  2944.  
  2945.  
  2946.  
  2947. M.I.T.                                                         [Page 50]
  2948.  
  2949. RFC 1013                                                       June 1987
  2950.  
  2951.  
  2952.            Returns a bit vector for the keyboard; each one bit
  2953.            indicates that the corresponding key is currently pressed.
  2954.            The vector is represented as 32 bytes.  Byte N (from 0)
  2955.            contains the bits for keys 8N to 8N+7, with the least
  2956.            significant bit in the byte representing key 8N.
  2957.  
  2958. OpenFont
  2959.            fid: FONT
  2960.            name: STRING8
  2961.  
  2962.            Errors: IDChoice, Name, Alloc
  2963.  
  2964.            Loads the specified font, if necessary, and associates
  2965.            identifier fid with it.  The font can be used as a source
  2966.            for any drawable.  The font name should use the ASCII
  2967.            encoding, and upper/lower case does not matter.
  2968.  
  2969. CloseFont
  2970.            font: FONT
  2971.  
  2972.            Errors: Font
  2973.  
  2974.            Deletes the association between the resource id and the
  2975.            font.  The font itself will be freed when no other
  2976.            resource references it.
  2977.  
  2978. QueryFont
  2979.            font: FONT or GCONTEXT
  2980.        =>
  2981.            font-info: FONTINFO
  2982.            char-infos: LISTofCHARINFO
  2983.  
  2984.            where
  2985.                    FONTINFO: [draw-direction: {LeftToRight, RightToLeft}
  2986.                               min-char-or-byte2,max-char-or-byte2:CARD16
  2987.                               min-byte1, max-byte1: CARD8
  2988.                               all-chars-exist: BOOL
  2989.                               default-char: CARD16
  2990.                               min-bounds: CHARINFO
  2991.                               max-bounds: CHARINFO
  2992.                               font-ascent: INT16
  2993.                               font-descent: INT16
  2994.                               properties: LISTofFONTPROP]
  2995.                    FONTPROP: [name: ATOM
  2996.                               value: INT32 or CARD32]
  2997.                    CHARINFO: [left-side-bearing: INT16
  2998.                               right-side-bearing: INT16
  2999.                               character-width: INT16
  3000.                               ascent: INT16
  3001.                               descent: INT16
  3002.                               attributes: CARD16]
  3003.  
  3004.  
  3005.  
  3006. M.I.T.                                                         [Page 51]
  3007.  
  3008. RFC 1013                                                       June 1987
  3009.  
  3010.  
  3011.            Errors: Font
  3012.  
  3013.            Returns logical information about a font.
  3014.  
  3015.            The draw-direction is essentially just a hint, indicating
  3016.            whether most char-infos have a positive (LeftToRight) or a
  3017.            negative (RightToLeft)  character-width metric.  The core
  3018.            protocol defines no support for vertical text.
  3019.  
  3020.            If min-byte1 and max-byte1 are both zero, then
  3021.            min-char-or-byte2 specifies the linear character index
  3022.            corresponding to the first elementb of char-infos, and
  3023.            max-char-or-byte2 specifies the linear character index of
  3024.            the last element.  If either min-byte1 or max-byte1 are
  3025.            non-zero, then both min-char-or-byte2 and
  3026.            max-char-or-byte2 will be less than 256, and the two-byte
  3027.            character index values corresponding to char-infos element
  3028.            N (counting from 0) are
  3029.                byte1 = N/D + min-byte1
  3030.                byte2 = N\D + min-char-or-byte2
  3031.            where
  3032.                D = max-char-or-byte2 - min-char-or-byte2 + 1
  3033.                / = integer division
  3034.                \ = integer modulus
  3035.  
  3036.            If char-infos has length zero, then min-bounds and
  3037.            max-bounds will be identical, and the effective
  3038.            char-infos is one filled with this char-info, of length
  3039.                L = D * (max-byte1 - min-byte1 + 1)
  3040.            That is, all glyphs in the specified linear or matrix
  3041.            range have the same information, as given by min-bounds
  3042.            (and max-bounds). If all-chars-exist is True, then all
  3043.            characters in char-infos have non-zero bounding boxes.
  3044.  
  3045.            The default-char specifies the character that will be
  3046.            used when an undefined or non-existent character is used.
  3047.            Note that default-char is a CARD16 (not CHAR2B); for a
  3048.            font using two-byte matrix format, the default-char has
  3049.            byte1 in the most significant byte, and byte2 in the
  3050.            least significant byte.  If the default-char itself
  3051.            specifies an undefined or non-existent character, then
  3052.            no printing is performed for an undefined or non-existent
  3053.            character.
  3054.  
  3055.            The min-bounds and max-bounds contain the minimum and
  3056.            maximum values of each individual CHARINFO component over
  3057.            all char-infos (ignoring non-existent characters).  The
  3058.            bounding box of the font, i.e., the smallest rectangle
  3059.            enclosing the shape obtained  by superimposing all
  3060.            characters at the same origin [x,y], has  its upper left
  3061.            coordinate at
  3062.  
  3063.  
  3064.  
  3065. M.I.T.                                                         [Page 52]
  3066.  
  3067. RFC 1013                                                       June 1987
  3068.  
  3069.  
  3070.                [x + min-bounds.left-side-bearing, y - max-bounds.
  3071.                     ascent] with a width of
  3072.                max-bounds.right-side-bearing - min-bounds.
  3073.                     left-side-bearing and a height of
  3074.                max-bounds.ascent + max-bounds.descent
  3075.  
  3076.            The font-ascent is the logical extent of the font above
  3077.            the baseline, for determining line spacing.  Specific
  3078.            characters may extend beyond this.  The font-descent is
  3079.            the logical extent of the font at or below the baseline,
  3080.            for determining line spacing. Specific characters may
  3081.            extend beyond this.  If the baseline is at Y-coordinate
  3082.            y, then the logical extent of the font is inclusive
  3083.            between the Y-coordinate values (y - font-ascent) and
  3084.            (y + font-descent - 1).
  3085.  
  3086.            A font is not guaranteed to have any properties.  Whether
  3087.            a property value is signed or unsigned must be derived
  3088.            from a prior knowledge of the property.  When possible,
  3089.            fonts should have at least the following properties (note
  3090.            that the trailing colon is not part of the name, and that
  3091.            upper/lower case matters).
  3092.  
  3093.            MIN_SPACE: CARD32
  3094.               The minimum interword spacing, in pixels.
  3095.            NORM_SPACE: CARD32
  3096.                The normal interword spacing, in pixels.
  3097.            MAX_SPACE: CARD32
  3098.                The maximum interword spacing, in pixels
  3099.            SUBSCRIPT_X: INT32
  3100.            SUBSCRIPT_Y: INT32
  3101.                Offsets from the character origin where subscripts
  3102.                should begin, in pixels.  If the origin is at [x,y],
  3103.                then subscripts should begin at [x + SubscriptX,
  3104.                    y + SubscriptY].
  3105.            UNDERLINE_POSITION: INT32
  3106.                Y offset from the baseline to the top of an underline,
  3107.                in pixels. If the baseline is Y-coordinate y, then
  3108.                the top of the underline is at (y +
  3109.                     UnderlinePosition).
  3110.            UNDERLINE_THICKNESS: CARD32
  3111.                Thickness of the underline, in pixels.
  3112.            STRIKEOUT_ASCENT: INT32
  3113.            STRIKEOUT_DESCENT: INT32
  3114.                Vertical extents for boxing or voiding characters, in
  3115.                pixels.  If the baseline is at Y-coordinate y, then
  3116.                the top of the strikeout box is at (y -
  3117.                StrikeoutAscent), and the height of the box is
  3118.                (StrikeoutAscent +  StrikeoutDescent).
  3119.            ITALIC_ANGLE: INT32
  3120.                The angle of characters in the font, in degrees
  3121.  
  3122.  
  3123.  
  3124. M.I.T.                                                         [Page 53]
  3125.  
  3126. RFC 1013                                                       June 1987
  3127.  
  3128.  
  3129.                scaled by 64, relative to the three-oclock position
  3130.                from the character origin, with positive indicating
  3131.                counterclockwise motion (as in Arc requests).
  3132.            X_HEIGHT: INT32
  3133.                "1 ex" as in TeX, but expressed in units of pixels.
  3134.                Often the height of lowercase x.
  3135.            QUAD_WIDTH: INT32
  3136.                "1 em" as in TeX, but expressed in units of pixels.
  3137.                Often the width of the digits 0-9.
  3138.            WEIGHT: CARD32
  3139.                The weight or boldness of the font, expressed as a
  3140.                value between 0 and 1000.
  3141.            POINT_SIZE: CARD32
  3142.                The point size, expressed in 1/10ths, of this font at
  3143.                the ideal resolution.  There are 72.27 points to the
  3144.                inch.
  3145.            RESOLUTION: CARD32
  3146.                The number of pixels per point, expressed in 1/100ths,
  3147.                at which this font was created.
  3148.  
  3149.            For a character origin at [x,y], the bounding box of a
  3150.            character,i.e., the smallest rectangle enclosing the
  3151.            character's shape,  described in terms of CHARINFO
  3152.            components, is a rectangle with its upper left corner at
  3153.                    [x + left-side-bearing, y - ascent]
  3154.            with a width of
  3155.                    right-side-bearing - left-side-bearing
  3156.            and a height of
  3157.                    ascent + descent
  3158.            and the origin for the next character is defined to be
  3159.                    [x + character-width, y]
  3160.            Note that the baseline is logically viewed as being just
  3161.            below non-descending characters (when descent is zero,
  3162.            only pixels with Y-coordinates less than y are drawn),
  3163.            and that the origin is logically viewed as being
  3164.            coincident with the left edge of a non-kerned character
  3165.            (when left-side-bearing is zero, no pixels with
  3166.            X-coordinate less than x are drawn).
  3167.  
  3168.            Note that CHARINFO metric values can be negative.
  3169.  
  3170.            A non-existent character is represented with all CHARINFO
  3171.            components zero.
  3172.  
  3173.            The interpretation of the per-character attributes field
  3174.            is undefined by the core protocol.
  3175.  
  3176. QueryTextExtents
  3177.            font: FONT or GCONTEXT
  3178.            items: STRING16
  3179.        =>
  3180.  
  3181.  
  3182.  
  3183. M.I.T.                                                         [Page 54]
  3184.  
  3185. RFC 1013                                                       June 1987
  3186.  
  3187.  
  3188.            draw-direction: {LeftToRight, RightToLeft}
  3189.            font-ascent: INT16
  3190.            font-descent: INT16
  3191.            overall-ascent: INT16
  3192.            overall-descent: INT16
  3193.            overall-width: INT32
  3194.            overall-left: INT32
  3195.            overall-right: INT32
  3196.  
  3197.            Errors: Font
  3198.  
  3199.            Returns the logical extents of the specified string of
  3200.            characters in the specified font.  Draw-direction,
  3201.            font-ascent, and font-descent are as described in
  3202.            QueryFont.  Overall-ascent is the maximum of the ascent
  3203.            metrics of all characters in the string, and
  3204.            overall-descent is the maximum of the descent metrics.
  3205.            Overall-width is the sum of the character-width metrics
  3206.            of all characters in the string.  For each character in
  3207.            the string, let W be the sum of the character-width
  3208.            metrics of all characters preceding it in the string,
  3209.            let L be the left-side-bearing metric of the character
  3210.            plus W, and let R be the right-side-bearing metric of
  3211.            the character plus W.  Overall-left is the minimum L of
  3212.            all characters in the string, and overall-right is the
  3213.            maximum R.
  3214.  
  3215.            For fonts defined with linear indexing rather than
  3216.            two-byte matrix indexing, the server will interpret each
  3217.            CHAR2B as a 16-bit number that has been transmitted most
  3218.            significant byte first (i.e., byte1 of the CHAR2B is
  3219.            taken as the most significant byte).
  3220.  
  3221.            If the font has no defined default-char, then undefined
  3222.            characters in   the string are taken to have all zero
  3223.            metrics.
  3224. ListFonts
  3225.            pattern: STRING8
  3226.            max-names: CARD16
  3227.        =>
  3228.            names: LISTofSTRING8
  3229.  
  3230.            Returns a list of length at most max-names, of names of
  3231.            fonts matching the pattern.  The pattern should use the
  3232.            ASCII encoding, and upper/lower case does not matter.
  3233.            In the pattern, the '?' character (octal value 77) will
  3234.            match any single character, and the character '*' (octal
  3235.            value 52) will match any number of characters.  The
  3236.            returned names are in lower case.
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242. M.I.T.                                                         [Page 55]
  3243.  
  3244. RFC 1013                                                       June 1987
  3245.  
  3246.  
  3247. ListFontsWithInfo
  3248.            pattern: STRING8
  3249.            max-names: CARD16
  3250.        =>
  3251.            fonts: LISTofFONTDATA
  3252.  
  3253.            where
  3254.                    FONTDATA: [name: STRING8
  3255.                               info: FONTINFO]
  3256.                    FONTINFO: <same type definition as in QueryFont>
  3257.  
  3258.            Like ListFonts, but also returns information about each
  3259.            font.  The information returned for each font is
  3260.            identical to what QueryFont would return (except that the
  3261.            per-character metrics are not returned).
  3262.  
  3263. SetFontPath
  3264.            path: LISTofSTRING8
  3265.  
  3266.            Errors: Value
  3267.  
  3268.            Defines the search path for font lookup.  There is only one
  3269.            search path per server, not one per client.  The
  3270.            interpretation of the strings is operating system dependent,
  3271.            but they are intended to specify directories to be
  3272.            searched in the order listed.
  3273.  
  3274.            Setting the path to the empty list restores the default
  3275.            path defined for the server.
  3276.  
  3277.            As a side-effect of executing this request, the server
  3278.            is guaranteed to flush all cached information about fonts
  3279.            for which there currently are no explicit resource ids
  3280.            allocated.
  3281.  
  3282.            The meaning of an error from this request is system
  3283.            specific.
  3284.  
  3285. GetFontPath
  3286.        =>
  3287.            path: LISTofSTRING8
  3288.  
  3289.            Returns the current search path for fonts.
  3290.  
  3291. CreatePixmap
  3292.            pid: PIXMAP
  3293.            drawable: DRAWABLE
  3294.            depth: CARD8
  3295.            width, height: CARD16
  3296.  
  3297.            Errors: IDChoice, Drawable, Value, Alloc
  3298.  
  3299.  
  3300.  
  3301. M.I.T.                                                         [Page 56]
  3302.  
  3303. RFC 1013                                                       June 1987
  3304.  
  3305.  
  3306.            Creates a pixmap, and assigns the identifier pid to it.
  3307.            Width and height must be non-zero.  Depth must be one of
  3308.            the depths supported by root of the specified drawable.
  3309.            The initial contents of the pixmap are undefined.
  3310.  
  3311.            It is legal to pass an InputOnly window as a drawable to
  3312.            this request.
  3313.  
  3314. FreePixmap
  3315.            pixmap: PIXMAP
  3316.  
  3317.            Errors: Pixmap
  3318.  
  3319.            Deletes the association between the resource id and the
  3320.            pixmap.  The pixmap storage will be freed when no other
  3321.            resource references it.
  3322.  
  3323. CreateGC
  3324.            cid: GCONTEXT
  3325.            drawable: DRAWABLE
  3326.            value-mask: BITMASK
  3327.            value-list: LISTofVALUE
  3328.  
  3329.            Errors: IDChoice, Drawable, Pixmap, Font, Match, Value, Alloc
  3330.  
  3331.            Creates a graphics context, and assigns the identifier cid to
  3332.            it.  The gcontext can be used with any destination drawable
  3333.            having the same root and depth as the specified drawable.
  3334.  
  3335.            The value-mask and value-list specify which components are to
  3336.            be explicitly initialized.  The context components are:
  3337.  
  3338.              alu-function: {Clear, And, AndReverse, Copy, AndInverted,
  3339.                             Noop, Xor, Or, Nor, Equiv, Invert,
  3340.                               OrReverse, CopyInverted, OrInverted,
  3341.                               Nand, Set}
  3342.              plane-mask: CARD32
  3343.              foreground: CARD32
  3344.              background: CARD32
  3345.              line-width: CARD16
  3346.              line-style: {Solid, OnOffDash, DoubleDash}
  3347.              cap-style: {NotLast, Butt, Round, Projecting}
  3348.              join-style: {Miter, Round, Bevel}
  3349.              fill-style: {Solid, Tiled, OpaqueStippled, Stippled}
  3350.              fill-rule: {EvenOdd, Winding}
  3351.              arc-mode: {Chord, PieSlice}
  3352.              tile: PIXMAP
  3353.              stipple: PIXMAP
  3354.              tile-stipple-x-origin: INT16
  3355.              tile-stipple-y-origin: INT16
  3356.              font: FONT
  3357.  
  3358.  
  3359.  
  3360. M.I.T.                                                         [Page 57]
  3361.  
  3362. RFC 1013                                                       June 1987
  3363.  
  3364.  
  3365.              subwindow-mode: {ClipByChildren, IncludeInferiors}
  3366.              graphics-exposures: BOOL
  3367.              clip-x-origin: INT16
  3368.              clip-y-origin: INT16
  3369.              clip-mask: PIXMAP or None
  3370.              dash-offset: CARD16
  3371.              dash-list: CARD8
  3372.  
  3373.            In graphics operations, given a source and destination pixel,
  3374.            the result is computed bitwise on corresponding bits of the
  3375.            pixels.  That is, a boolean operation is performed in each
  3376.            bit plane. The plane-mask restricts the operation to a subset
  3377.            of planes.  That is, the result is
  3378.  
  3379.            ((src FUNC dst) AND plane-mask) OR (dst AND (NOT plane-mask))
  3380.  
  3381.            Range checking is not performed on the values for foreground,
  3382.            background, or plane-mask; they are simply truncated to the
  3383.            appropriate number of bits.
  3384.  
  3385.            The meanings of the alu-functions are:
  3386.  
  3387.                Clear               0
  3388.                And                 src AND dst
  3389.                AndReverse          src AND (NOT dst)
  3390.                Copy                src
  3391.                AndInverted         (NOT src) AND dst
  3392.                NoOp                dst
  3393.                Xor                 src XOR dst
  3394.                Or                  src OR dst
  3395.                Nor                 (NOT src) AND (NOT dst)
  3396.                Equiv               (NOT src) XOR dst
  3397.                Invert              NOT dst
  3398.                OrReverse           src OR (NOT dst)
  3399.                CopyInverted        NOT src
  3400.                OrInverted          (NOT src) OR dst
  3401.                NAnd                (NOT src) OR (NOT dst)
  3402.                Set                 1
  3403.  
  3404.            Line-width is measured in pixels and can be greater than or
  3405.            equal to one (a "wide" line) or the special value zero (a
  3406.            "thin" line).
  3407.  
  3408.            Wide lines are drawn centered on the path described by the
  3409.            graphics request.  Unless otherwise specified by the join or
  3410.            cap style, the bounding box of a wide line with endpoints
  3411.            [x1, y1], [x2, y2], and width w is a rectangle with vertices
  3412.            at the following real coordinates:
  3413.  
  3414.            [x1-(w*sn/2), y1+(w*cs/2)], [x1+(w*sn/2), y1-(w*cs/2)],
  3415.            [x2-(w*sn/2), y2+(w*cs/2)], [x2+(w*sn/2), y2-(w*cs/2)]
  3416.  
  3417.  
  3418.  
  3419. M.I.T.                                                         [Page 58]
  3420.  
  3421. RFC 1013                                                       June 1987
  3422.  
  3423.  
  3424.            where sn is the sine of the angle of the line and cs is the
  3425.            cosine of the angle of the line.  A pixel is part of the line
  3426.            (and hence drawn) if the center of the pixel is fully inside
  3427.            the bounding box (which is viewed as having infinitely thin
  3428.            edges).  If the center of the pixel is exactly on the
  3429.            bounding box, it is part of the line if and only if the
  3430.            interior is immediately to its right (x increasing
  3431.            direction).  Pixels with centers on a horizontal edge are a
  3432.            special case and are part of the line if and only if the
  3433.            interior is immediately below (y increasing direction).
  3434.            Note that this description is a mathematical model
  3435.            describing the pixels that are drawn for a wide line and
  3436.            does not imply that trigonometry is required to implement
  3437.            such a model.  Real or fixed point arithmetic is
  3438.            recommended for computing the corners of the line endpoints
  3439.            for lines greater than one pixel in width.
  3440.  
  3441.            Thin lines (zero line-width) are "one pixel wide" lines drawn
  3442.            using an unspecified, device dependent algorithm (for
  3443.            example, Bresenham). There are only two constraints on this
  3444.            algorithm. First, if a line is drawn unclipped from [x1,y1]
  3445.            to [x2,y2] and another line is drawn unclipped from [x1+dx,
  3446.            y1+dy] to [x2+dx,y2+dy], then a point [x,y] is touched by
  3447.            drawing the first line if and only if the point [x+dx,y+dy]
  3448.            is touched by drawing the second line.  Second, the effective
  3449.            set of points comprising a line cannot be affected by
  3450.            clipping; that is, a point is touched in a clipped line if
  3451.            and only if the point lies inside the clipping region and
  3452.            the point would be touched by the line when drawn unclipped.
  3453.  
  3454.            Note that a wide line drawn from [x1,y1] to [x2,y2] always
  3455.            draws the same pixels as a wide line drawn from [x2,y2] to
  3456.            [x1,y1], not counting cap and join styles, but this property
  3457.            is not guaranteed for thin lines.  Also note that "jags" in
  3458.            adjacent wide lines will always line up properly, but this
  3459.            property is not guaranteed for thin lines.  A line-width of
  3460.            zero differs from a line-width of one in which pixels are
  3461.            drawn.  In general, drawing a thin line will be faster than
  3462.            drawing a wide line of width one, but thin lines may not mix
  3463.            well aesthetically desirable to obtain precise and uniform
  3464.            results across all displays, a client should always use a
  3465.            line-width of one, rather than a line-width of zero.
  3466.  
  3467.            The line-style defines which segments of a line are drawn:
  3468.                Solid:  the full path of the line is drawn
  3469.                DoubleDash: the full path of the line is drawn, but the
  3470.                            segments defined by the even dashes are
  3471.                            filled differently than the segments defined
  3472.                            by the odd dashes (see fill-style)
  3473.                OnOffDash: only the segments defined by the even dashes
  3474.                           are drawn, and cap-style applies to each
  3475.  
  3476.  
  3477.  
  3478. M.I.T.                                                         [Page 59]
  3479.  
  3480. RFC 1013                                                       June 1987
  3481.  
  3482.  
  3483.                           individual segment (except NotLast is treated
  3484.                           as Butt for internal caps)
  3485.  
  3486.            The cap-style defines how the endpoints of a path are drawn:
  3487.                NotLast: equivalent to Butt, except that for a
  3488.                         line-width of zero or one the final endpoint is
  3489.                         not drawn
  3490.                Butt: square at the endpoint, with no projection beyond
  3491.                Round: a circular arc with diameter equal to the
  3492.                       line-width, centered on the endpoint; equivalent
  3493.                       to Butt for line-width zero or one
  3494.                Projecting: square at the end, but the path continues
  3495.                            beyond the endpoint for a distance equal to
  3496.                            half the line-width; equivalent to Butt for
  3497.                            line-width zero or one
  3498.  
  3499.            The join-style defines how corners are drawn for wide lines:
  3500.                Miter: the outer edges of the two lines extend to meet at
  3501.                       an angle
  3502.                Round: a circular arc with diameter equal to the
  3503.                       line-width, centered on the joinpoint
  3504.                Bevel: Butt endpoint styles, and then the triangular
  3505.                       "notch" filled
  3506.  
  3507.            The tile/stipple and clip origins are interpreted relative to
  3508.            the origin of whatever destination drawable is specified in a
  3509.            graphics request.
  3510.  
  3511.            The tile pixmap must have the same root and depth as the
  3512.            gcontext (else a Match error).  The stipple pixmap must have
  3513.            depth one, and must have the same root as the gcontext (else
  3514.            a Match error).  For stipple operations, the stipple pattern
  3515.            is tiled in a  single plane, and acts as an additional clip
  3516.            mask to be ANDed with the clip-mask.  Any size pixmap can be
  3517.            used for tiling or stippling, although some sizes may be
  3518.            faster to use than others.
  3519.  
  3520.            The fill-style defines the contents of the source for line,
  3521.            text, and fill requests.  For all text and fill requests
  3522.            (PolyText8, PolyText16, PolyFillRectangle, FillPoly,
  3523.            PolyFillArc), for line  requests (PolyLine, PolySegment,
  3524.            PolyRectangle, PolyArc) with line-style Solid, and for the
  3525.            even dashes for line requests with line-style OnOffDash or
  3526.            DoubleDash:
  3527.                Solid: foreground
  3528.                Tiled: tile
  3529.                OpaqueStippled: a tile with the same width and height as
  3530.                                stipple, but with background everywhere
  3531.                                stipple has a zero and with foreground
  3532.                                everywhere stipple has a one
  3533.                Stippled: foreground masked by stipple
  3534.  
  3535.  
  3536.  
  3537. M.I.T.                                                         [Page 60]
  3538.  
  3539. RFC 1013                                                       June 1987
  3540.  
  3541.  
  3542.            For the odd dashes for line requests with line-style
  3543.            DoubleDash:
  3544.                Solid: background
  3545.                Tiled: same as for even dashes
  3546.                OpaqueStippled: same as for even dashes
  3547.                Stippled: background masked by stipple
  3548.  
  3549.            The dash-list value allowed here is actually a simplified
  3550.            form of the more general patterns that can be set with
  3551.            SetDashes.Specifying a value of N here is equivalent to
  3552.            specifying the two element list [N, N] in SetDashes.  The
  3553.            value must be non-zero.  The meaning of dash-offset and
  3554.            dash-list are explained in the SetDashes request.
  3555.  
  3556.            The clip-mask restricts writes to the destination drawable;
  3557.            only pixels where the clip-mask has a one bit are drawn.  It
  3558.            affects all graphics requests.  The clip-mask does not clip
  3559.            sources.  The clip-mask origin is interpreted relative to the
  3560.            origin of whatever destination drawable is specified in a
  3561.            graphics request.  If a pixmap is specified as the clip-mask,
  3562.            it must have depth one and have the same root as the gcontext
  3563.            (else a Match error).  The clip-mask can also be set with the
  3564.            SetClipRectangles request.
  3565.  
  3566.            For ClipByChildren, both source and destination windows are
  3567.            additionally clipped by all viewable InputOutput children.
  3568.            For IncludeInferiors, neither source nor destination window
  3569.            is clipped by inferiors; this will result in drawing through
  3570.            subwindow boundaries. The use of IncludeInferiors on a window
  3571.            of one depth with mapped inferiors of differing depth is not
  3572.            illegal, but the semantics isundefined by the core protocol.
  3573.  
  3574.            The fill-rule defines what pixels are inside (i.e., are
  3575.            drawn) for paths given in FillPoly requests.  EvenOdd means
  3576.            a point is inside if an infinite ray with the point as origin
  3577.            crosses the path an odd number of times.  For Winding, a
  3578.            point is inside if an infinite ray with the point as origin
  3579.            crosses an unequal number of clockwise and counterclockwise
  3580.            directed path segments.  For both rules, a "point" is
  3581.            infinitely small, and the path is an infinitely thin line.
  3582.            A pixel is inside if the center point of the pixel is inside
  3583.            and the center point is not on the boundary.  If the center
  3584.            point is on the boundary, the pixel is inside if and only if
  3585.            the polygon interior is immediately to its right (x
  3586.            increasing direction).  Pixels with centers along a
  3587.            horizontal edge are a special case and are inside if and
  3588.            only if the polygon interior is immediately below (y
  3589.            increasing direction).
  3590.  
  3591.            The arc-mode controls filling in the PolyFillArc request.
  3592.  
  3593.  
  3594.  
  3595.  
  3596. M.I.T.                                                         [Page 61]
  3597.  
  3598. RFC 1013                                                       June 1987
  3599.  
  3600.  
  3601.            The graphics-exposures flag controls GraphicsExposure event
  3602.            generation for CopyArea and CopyPlane requests (and any
  3603.            similar requests defined by extensions).
  3604.  
  3605.            The default component values are:
  3606.                function: Copy
  3607.                plane-mask: all ones
  3608.                foreground: 0
  3609.                background: 1
  3610.                line-width: 0
  3611.                line-style: Solid
  3612.                cap-style: Butt
  3613.                join-style: Miter
  3614.                fill-style: Solid
  3615.                full-rule: EvenOdd
  3616.                arc-mode: PieSlice
  3617.                tile: pixmap of unspecified size filled with forground
  3618.                      pixell (i.e., client specified pixel if any,
  3619.                      else 0)
  3620.                stipple: pixmap of unspecified size filled with ones
  3621.                tile-stipple-x-origin: 0
  3622.                tile-stipple-y-origin: 0
  3623.                font: <implementation dependent>
  3624.                subwindow-mode: ClipByChildren
  3625.                graphics-exposures: True
  3626.                clip-x-origin: 0
  3627.                clip-y-origin: 0
  3628.                clip-mask: None
  3629.                dash-offset: 0
  3630.                dash-list: 4 (i.e., the list [4, 4])
  3631.  
  3632.            Storing a pixmap in a gcontext might or might not result in a
  3633.            copy being made.  If the pixmap is later used as the
  3634.            destination for a graphics request, the change might or might
  3635.            not be reflected in the gcontext.  If the pixmap is used
  3636.            simultaneously  in a graphics request as both a destination
  3637.            and as a tile or stipple. the results are not defined.
  3638.  
  3639.            It is quite likely that some amount of gcontext information
  3640.            will be cached in display hardware, and that such hardware
  3641.            can only cache a small number of gcontexts.  Given the number
  3642.            and complexity of components, clients should view switching
  3643.            between gcontexts with nearly identical state as
  3644.            significantly more expensive than making minor changes to a
  3645.            single gcontext.
  3646.  
  3647. ChangeGC
  3648.            gc: GCONTEXT
  3649.            value-mask: BITMASK
  3650.            value-list: LISTofVALUE
  3651.  
  3652.  
  3653.  
  3654.  
  3655. M.I.T.                                                         [Page 62]
  3656.  
  3657. RFC 1013                                                       June 1987
  3658.  
  3659.  
  3660.            Errors: GContext, Pixmap, Font, Match, Value, Alloc
  3661.  
  3662.            Changes components in gc.  The value-mask and value-list
  3663.            specify which components are to be changed.  The values and
  3664.            restrictions are the same as for CreateGC.
  3665.  
  3666.            Changing the clip-mask also overrides any previous
  3667.            SetClipRectangles request on the context.  Changing the
  3668.            dash-offset or dash-list overrides any previous SetDashes
  3669.            request on the context.
  3670.  
  3671.            The order in which components are verified and altered is
  3672.            server dependent.  If an error is generated, a subset of the
  3673.            components may have been altered.
  3674.  
  3675. CopyGC
  3676.            src-gc, dst-gc: GCONTEXT
  3677.            value-mask: BITMASK
  3678.  
  3679.            Errors: GContext, Value, Match, Alloc
  3680.  
  3681.            Copies components from src-gc to dst-gc.  The value-mask
  3682.            specifies which components to copy, as for CreateGC.  The
  3683.            two gcontexts must have the same root and the same depth
  3684.            (else a Match error).
  3685.  
  3686. SetDashes
  3687.            gc: GCONTEXT
  3688.            dash-offset: CARD16
  3689.            dash-list: LISTofCARD8
  3690.  
  3691.            Errors: GContext, Value, Alloc
  3692.  
  3693.            Sets the dash-offset and dash-list in gc for dashed line
  3694.            styles.  The initial and alternating elements of the
  3695.            dash-list are the "even" dashes, the others are the
  3696.            "odd" dashes.  All of the elements must be non-zero.
  3697.            The dash-offset defines the phase of the pattern,
  3698.            specifying how many pixels into the dash-list the pattern
  3699.            should actually begin in any single graphics request.
  3700.            Dashing is continuous through path segments combined with
  3701.            a join-style, but is reset to the dash-offset each time a
  3702.            cap-style is applied.
  3703.  
  3704. SetClipRectangles
  3705.            gc: GCONTEXT
  3706.            clip-x-origin, clip-y-origin: INT16
  3707.            rectangles: LISTofRECTANGLE
  3708.            ordering: {UnSorted, YSorted, YXSorted, YXBanded}
  3709.  
  3710.            Errors: GContext, Value, Alloc, Match
  3711.  
  3712.  
  3713.  
  3714. M.I.T.                                                         [Page 63]
  3715.  
  3716. RFC 1013                                                       June 1987
  3717.  
  3718.  
  3719.            Changes clip-mask in gc to the specified list of rectangles
  3720.            and sets the clip origin.  Output will be clipped to remain
  3721.            contained within the rectangles.  The clip origin is
  3722.            interpreted relative to the origin of whatever destination
  3723.            drawable is specified in a graphics request.  The rectangle
  3724.            coordinates are interpreted relative to the clip origin.
  3725.            The rectangles should be non-intersecting, or graphics
  3726.            results will be undefined.
  3727.  
  3728.            If known by the client, ordering relations on the rectangles
  3729.            can be specified with the ordering argument; this may provide
  3730.            faster operation by the server.  If an incorrect ordering is
  3731.            specified, the server may generate a Match error, but is not
  3732.            required to do so; if no error is generated, the graphics
  3733.            results are undefined. UnSorted means the rectangles are in
  3734.            arbitrary order.  YSorted means that the rectangles are
  3735.            non-decreasing in their Y origin. YXSorted additionally
  3736.            constrains YSorted order in that all rectangles with an equal
  3737.            Y origin are non-decreasing in their X origin.  YXBanded
  3738.            additionally constrains YXSorted by requiring that for every
  3739.            possible Y scanline, all rectangles that include that
  3740.            scanline have identical Y origins and Y extents.
  3741.  
  3742. FreeGC
  3743.            gc: GCONTEXT
  3744.  
  3745.            Errors: GContext
  3746.  
  3747.            Deletes the association between the resource id and the
  3748.            gcontext, and destroys the gcontext.
  3749.  
  3750. ClearToBackground
  3751.            window: WINDOW
  3752.            x, y: INT16
  3753.            width, height: CARD16
  3754.            exposures: BOOL
  3755.  
  3756.            Errors: Window, Value, Match
  3757.  
  3758.            The x and y coordinates are relative to the window's origin,
  3759.            and specify the upper left corner of the rectangle.  If width
  3760.            is zero, it is replaced with the current width of the window
  3761.            minus x.  If height is zero, it is replaced with the current
  3762.            height of the window minus y.  If the window has a defined
  3763.            background tile, the rectangle is tiled with a plane-mask of
  3764.            all ones and alu-function of Copy.  If the window has
  3765.            background None, the contents of the window are not changed.
  3766.            In eithercase, if  exposures is True, then one or more
  3767.            exposure events are generated for regions of the rectangle
  3768.            that are eithervisible or are being retained in a backing
  3769.            store.
  3770.  
  3771.  
  3772.  
  3773. M.I.T.                                                         [Page 64]
  3774.  
  3775. RFC 1013                                                       June 1987
  3776.  
  3777.  
  3778.            It is a Match error to use an InputOnly window in this
  3779.            request.
  3780. CopyArea
  3781.            src-drawable, dst-drawable: DRAWABLE
  3782.            gc: GCONTEXT
  3783.            src-x, src-y: INT16
  3784.            width, height: CARD16
  3785.            dst-x, dst-y: INT16
  3786.  
  3787.            Errors: Drawable, GContext, Match
  3788.  
  3789.            Combines the specified rectangle of src-drawable with the
  3790.            specified rectangle of dst-drawable.  The src-x and src-y
  3791.            coordinates are relative to src-drawable's origin, dst-x and
  3792.            dst-y are relative to dst-drawable's origin, each pair
  3793.            specifying the  upper left corner of the rectangle.
  3794.            Src-drawable must have the same root and the same depth as
  3795.            dst-drawable (else a Match error).
  3796.  
  3797.            If regions of the source rectangle are obscured and have not
  3798.            been retained by the server, or if regions outside the
  3799.            boundaries of the source drawable are specified, then the
  3800.            following occurs.  If the dst-drawable is a window with a
  3801.            background of other than  None, the corresponding regions of
  3802.            the destination are tiled (with plane-mask of ones and
  3803.            alu-function Copy) with that background.  Regardless, if
  3804.            graphics-exposures in gc is True, GraphicsExposure events
  3805.            for the corresponding desitnation regions are generated.
  3806.  
  3807.            If graphics-exposures if True but no regions are exposed,
  3808.            then a NoExposure event is generated.
  3809.  
  3810.            GC components: alu-function, plane-mask, foreground,
  3811.            subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
  3812.  
  3813. CopyPlane
  3814.            scr-drawable, dst-drawable: DRAWABLE
  3815.            GC:Gcontext
  3816.            src-x, src-y: INT16
  3817.            width, height: CARD16
  3818.            dst-x, dst-y: INT16
  3819.            bit-plane: CARD32
  3820.  
  3821.            Errors: Drawable, GContext, Value, Match
  3822.  
  3823.            Src-drawable must have the same root as dst-srawable (else
  3824.            a match error), but need not have the same depth.
  3825.            Bit-plane must have exactly one bit set.  Effectively, that
  3826.            plane of the src-drawable and the fore-ground/background
  3827.            pixels in gc are combined to form a pixmap of the same
  3828.            depth as dst-drawable, and the equivalent of a CopyArea is
  3829.  
  3830.  
  3831.  
  3832. M.I.T.                                                         [Page 65]
  3833.  
  3834. RFC 1013                                                       June 1987
  3835.  
  3836.  
  3837.            performed, with all the same exposure semantics.
  3838.  
  3839.            GC components: alu-function, plan-mask, foreground,
  3840.            background, subwindow-mode, graphics-exposures,
  3841.            clip-x-origin, clip-y-origin, clip-mask
  3842.  
  3843. PolyPoint
  3844.            drawable: DRAWABLE
  3845.            gc: GCONTEXT
  3846.            coordinate-mode: {Origin, Previous}
  3847.            points: LISTofPOINT
  3848.  
  3849.            Errors: Drawable, GContext, Value, Match
  3850.  
  3851.            Combines the foreground pixel in gc with the pixel at each
  3852.            point in the drawable.  The points are drawn in the order
  3853.            listed.
  3854.  
  3855.            The first point is always relative to the drawable's origin;
  3856.            the rest are relative either to that origin or the previous
  3857.            point, depending on the coordinate-mode.
  3858.  
  3859.            GCcomponents: alu-function, plane-mask, foreground,
  3860.            subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
  3861.  
  3862. PolyLine
  3863.            drawable: DRAWABLE
  3864.            gc: GCONTEXT
  3865.            coordinate-mode: {Origin, Previous}
  3866.            points: LISTofPOINT
  3867.  
  3868.            Errors: Drawable, GContext, Value, Match
  3869.  
  3870.            Draws lines between each pair of points (point[i], point
  3871.            [i+1]). The lines are drawn in the order listed.  The lines
  3872.            join correctly at all intermediate points, and if the first
  3873.            and last points coincide, the first and last lines also join
  3874.            correctly.
  3875.  
  3876.            For any given line, no pixel is drawn more than once.  If
  3877.            thin (zero line-width) lines intersect, the intersecting
  3878.            pixels are drawn multiple times.  If wide lines intersect,
  3879.            the intersecting pixels are drawn only once, as though the
  3880.            entire PolyLine were a single filled shape.
  3881.  
  3882.            The first point is always relative to the drawable's origin;
  3883.            the rest are relative either to that origin or the previous
  3884.            point,  depending on the coordinate-mode.
  3885.  
  3886.            GC components: alu-function, plane-mask, line-width,
  3887.            line-style, cap-style, join-style, fill-style,
  3888.  
  3889.  
  3890.  
  3891. M.I.T.                                                         [Page 66]
  3892.  
  3893. RFC 1013                                                       June 1987
  3894.  
  3895.  
  3896.            subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
  3897.  
  3898.            GC mode-dependent components: foreground, background, tile,
  3899.            stipple, tile-stipple-x-origin, tile-stipple-y-origin,
  3900.            dash-offset,dash-list
  3901.  
  3902. PolySegment
  3903.            drawable: DRAWABLE
  3904.            gc: GCONTEXT
  3905.            segments: LISTofSEGMENT
  3906.  
  3907.            where SEGMENT: [x1, y1, x2, y2: INT16]
  3908.  
  3909.            Errors: Drawable, GContext, Match
  3910.  
  3911.            For each segment, draws a line between [x1, y1] and [x2, y2].
  3912.            The lines are drawn in the order listed.  No joining is
  3913.            performed at coincident end points.  For any given line, no
  3914.            pixel is drawn more than once.  If lines intersect, the
  3915.            intersecting pixels are drawn multiple times.
  3916.  
  3917.            GC components: alu-function, plane-mask, line-width,
  3918.            line-style, cap-style, fill-style, subwindow-mode,
  3919.            clip-x-origin, clip-y-origin,clip-mask
  3920.  
  3921.            GC mode-dependent components: foreground, background, tile,
  3922.            stipple,tile-stipple-x-origin, tile-stipple-y-origin,
  3923.            dash-offset, dash-list
  3924.  
  3925. PolyRectangle
  3926.            drawable: DRAWABLE
  3927.            gc: GCONTEXT
  3928.            rectangles: LISTofRECTANGLE
  3929.  
  3930.            Errors: Drawable, GContext, Match
  3931.  
  3932.            Draws the outlines of the specified rectangles, as if a
  3933.            five-point PolyLine were specified for each rectangle.  The x
  3934.            and y coordinates of each rectangle are relative to the
  3935.            drawable's origin, and define the upper left corner of the
  3936.            rectangle.
  3937.  
  3938.            The rectangles are drawn in the order listed.  For any given
  3939.            rectangle, no pixel is drawn more than once.  If rectangles
  3940.            intersect, the intersecting pixels are drawn multiple times.
  3941.  
  3942.            GC components: alu-function, plane-mask, line-width,
  3943.            line-style, join-style, fill-style, subwindow-mode,
  3944.            clip-x-origin, clip-y-origin, clip-mask
  3945.  
  3946.            GC mode-dependent components: foreground, background, tile,
  3947.  
  3948.  
  3949.  
  3950. M.I.T.                                                         [Page 67]
  3951.  
  3952. RFC 1013                                                       June 1987
  3953.  
  3954.  
  3955.            stipple, tile-stipple-x-origin, tile-stipple-y-origin,
  3956.            dash-offset, dash-list
  3957.  
  3958. PolyArc
  3959.            drawable: DRAWABLE
  3960.            gc: GCONTEXT
  3961.            arcs: LISTofARC
  3962.  
  3963.            Errors: Drawable, GContext, Match
  3964.  
  3965.            Draws circular or elliptical arcs.  Each arc is specified by
  3966.            a rectangle and two angles.  The x and y coordinates are
  3967.            relative to the origin of the drawable, and define the upper
  3968.            left corner of the rectangle.  The center of the circle or
  3969.            ellipse is the center of the rectangle, and the major and
  3970.            minor axes are specified by the width and height,
  3971.            respectively.  The angles are signed integers in degrees
  3972.            scaled by 64, with positive indicating counterclockwise
  3973.            motion and negative indicating clockwise motion.  The start
  3974.            of the arc is specified by angle1 relative to the
  3975.            three-oclock position from the center, and the path and
  3976.            extent of the arc is specified by angle2 relative to the
  3977.            start of the arc.  If the magnitude of angle2 is greater
  3978.            than 360 degrees, it is truncated to 360 degrees.
  3979.  
  3980.            The arcs are drawn in the order listed.  If the last point in
  3981.            one arc coincides with the first point in the following arc,
  3982.            the two arcs will join correctly.  If the first point in the
  3983.            first arc coincides with the last point in the last arc, the
  3984.            two arcs will join correctly.  For any given arc, no pixel is
  3985.            drawn more than once.  If two arcs join correctly and the
  3986.            line-width is greater than zero and the arcs intersect, no
  3987.            pixel is drawn more than once.  Otherwise, the intersecting
  3988.            pixels of intersecting arcs are drawn multiple times.
  3989.            Specifying an arc with one endpoint and a clockwise extent
  3990.            draws the same pixels as specifying the other endpoint and an
  3991.            equivalent counterclockwise extent, except as it affects
  3992.            joins.
  3993.  
  3994.            By specifying one axis to be zero, a horizontal or vertical
  3995.            line can be drawn.
  3996.  
  3997.            Angles are computed based solely on the coordinate system,
  3998.            ignoring the aspect ratio.
  3999.  
  4000.            GC components: alu-function, plane-mask, line-width,
  4001.            line-style, cap-style, join-style, fill-style,
  4002.            subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
  4003.  
  4004.            GC mode-dependent components: foreground, background, tile,
  4005.            stipple,tile-stipple-x-origin, tile-stipple-y-origin,
  4006.  
  4007.  
  4008.  
  4009. M.I.T.                                                         [Page 68]
  4010.  
  4011. RFC 1013                                                       June 1987
  4012.  
  4013.  
  4014.            dash-offset, dash-list
  4015. FillPoly
  4016.            drawable: DRAWABLE
  4017.            gc: GCONTEXT
  4018.            shape: {Complex, Nonconvex, Convex}
  4019.            coordinate-mode: {Origin, Previous}
  4020.            points: LISTofPOINT
  4021.  
  4022.            Errors: Drawable, GContext, Match, Value
  4023.  
  4024.            Fills the region closed by the specified path.  The path is
  4025.            closed automatically if the last point in the list does not
  4026.            coincide with the first point.  No pixel of the region is
  4027.            drawn more than once.
  4028.  
  4029.            The first point is always relative to the drawable's origin;
  4030.            the rest are relative either to that origin or the previous
  4031.            point, depending on the coordinate-mode.
  4032.  
  4033.            The shape parameter may be used by the server to improve
  4034.            performance. Complex means the path may self-intersect.
  4035.  
  4036.            Nonconvex means the path does not self-intersect, but the
  4037.            shape is not wholly convex.  If known by the client,
  4038.            specifying Nonconvex over Complex may improve performance. If
  4039.            Nonconvex is specified for a self-intersecting path, the
  4040.            graphics results are undefined.
  4041.  
  4042.            Convex means the path is wholly convex. If known by the
  4043.            client, specifying Convex can improve performance.  If Convex
  4044.            is specified for a path that is not convex, the graphics
  4045.            results are undefined.
  4046.  
  4047.            GC components: alu-function, plane-mask, fill-style,
  4048.            fill-rule, subwindow-mode, clip-x-origin, clip-y-origin,
  4049.            clip-mask
  4050.  
  4051.            GC mode-dependent components: foreground, tile, stipple,
  4052.            tile-stipple-x-origin, tile-stipple-y-origin
  4053.  
  4054. PolyFillRectangle
  4055.            drawable: DRAWABLE
  4056.            gc: GCONTEXT
  4057.            rectangles: LISTofRECTANGLE
  4058.  
  4059.            Errors: Drawable, GContext, Match
  4060.  
  4061.            Fills the specified rectangles.  The x and y coordinates of
  4062.            each rectangle are relative to the drawable's origin, and
  4063.            define the upper left corner of the rectangle.
  4064.  
  4065.  
  4066.  
  4067.  
  4068. M.I.T.                                                         [Page 69]
  4069.  
  4070. RFC 1013                                                       June 1987
  4071.  
  4072.  
  4073.            The rectangles are drawn in the order listed.  For any given
  4074.            rectangle, no pixel is drawn more than once.  If rectangles
  4075.            intersect, the intersecting pixels are drawn multiple times.
  4076.  
  4077.            GC components: alu-function, plane-mask, fill-style,
  4078.            fill-rule, subwindow-mode, clip-x-origin, clip-y-origin,
  4079.            clip-mask
  4080.  
  4081.            GC mode-dependent components: foreground, tile, stipple,
  4082.            tile-stipple-x-origin, tile-stipple-y-origin
  4083.  
  4084. PolyFillArc
  4085.            drawable: DRAWABLE
  4086.            gc: GCONTEXT
  4087.            arcs: LISTofARC
  4088.  
  4089.            Errors: Drawable, GContext, Match
  4090.  
  4091.            For each arc, fills the region closed by the specified arc
  4092.            and one or two line segments, depending on the arc-mode.  For
  4093.            Chord, the single line segment joining the endpoints of the
  4094.            arc is used.  For PieSlice, the two line segments joining the
  4095.            endpoints of the arc with the center point are used.  The
  4096.            arcs are as specified in the PolyArc request.
  4097.  
  4098.            The arcs are filled in the order listed.  For any given arc,
  4099.            no pixel is drawn more than once.  If regions intersect, the
  4100.            intersecting pixels are drawn multiple times.
  4101.  
  4102.            GC components: alu-function, plane-mask, fill-style,
  4103.            fill-rule, arc-mode, subwindow-mode, clip-x-origin,
  4104.            clip-y-origin, clip-mask
  4105.  
  4106.            GC mode-dependent components: foreground, tile, stipple,
  4107.            tile-stipple-x-origin, tile-stipple-y-origin
  4108.  
  4109. PutImage
  4110.            drawable: DRAWABLE
  4111.            gc: GCONTEXT
  4112.            depth: CARD8
  4113.            width, height: CARD16
  4114.            dst-x, dst-y: INT16
  4115.            left-pad: CARD8
  4116.            format: {Bitmap, XYPixmap, ZPixmap}
  4117.            bits: <bits>
  4118.  
  4119.            Errors: Drawable, GContext, Match, Value, Alloc
  4120.  
  4121.            Combines an image with a rectangle of the drawable.  The
  4122.            dst-x and dst-y coordinates are relative to the drawable's
  4123.            origin.
  4124.  
  4125.  
  4126.  
  4127. M.I.T.                                                         [Page 70]
  4128.  
  4129. RFC 1013                                                       June 1987
  4130.  
  4131.  
  4132.            If Bitmap format is used, then depth must be one (else a
  4133.            Match error) and the image must be in XYFormat. The
  4134.            foreground pixel in gc defines the source for one bits in the
  4135.            image, and the background pixel defines the source for the
  4136.            zero bits.
  4137.  
  4138.            For XYPixmap and ZPixmap, depth must match the depth of
  4139.            drawable (else a Match error).  For XYPixmap, the image must
  4140.            be sent in XYFormat.  For ZPixmap, the image must be sent in
  4141.            the ZFormat defined for the given depth.
  4142.  
  4143.            The left-pad must be zero for ZPixmap format.  For Bitmap and
  4144.            XYPixmap format, left-pad must be less than
  4145.            bitmap-format-scanline-pad (as given in the server connection
  4146.            setup info).  The first left-pad bits in every scanline are
  4147.            to be ignored by the server; the actual image begins that
  4148.            many bits into the data.  The width argument defines the width
  4149.            of the actual image, and does not include left-pad.
  4150.  
  4151.            GC components: alu-function, plane-mask, subwindow-mode,
  4152.            clip-x-origin, clip-y-origin, clip-mask
  4153.  
  4154.            GC mode-dependent components: foreground, background
  4155.  
  4156. GetImage
  4157.            drawable: DRAWABLE
  4158.            x, y: INT16
  4159.            width, height: CARD16
  4160.            plane-mask: CARD32
  4161.            format: {XYFormat, ZFormat}
  4162.        =>
  4163.            depth: CARD8
  4164.            visual: VISUALID or None
  4165.            bits: <bits>
  4166.  
  4167.            Errors: Drawable, Value, Match
  4168.  
  4169.            Returns the contents of the given rectangle of the drawable
  4170.            in the given format.  The x and y coordinates are relative to
  4171.            the drawable's origin, and define the upper left corner of
  4172.            the rectangle. If XYFormat is specified, only the bit planes
  4173.            specified in plane-mask are transmitted.  If ZFormat is
  4174.            specified, then bits in all planes not specified in
  4175.            plane-mask transmitted as zero.  The returned depth specifies
  4176.            the number of bits per pixel of the image.  If the drawable
  4177.            is a window,  its visual type is returned; if the drawable
  4178.            is a pixmap,the visual is None.
  4179.  
  4180.            If the drawable is a window, the window must be mapped, and
  4181.            it must be the case that, if there were no inferiors or
  4182.            overlapping windows, the specified rectangle of the window
  4183.  
  4184.  
  4185.  
  4186. M.I.T.                                                         [Page 71]
  4187.  
  4188. RFC 1013                                                       June 1987
  4189.  
  4190.  
  4191.            would be fully visible on the screen will include any
  4192.            visible portions of inferiors or overlapping windows
  4193.            contained in the rectangle, but if these windows are of
  4194.            different depth than the specified window, the contents
  4195.            returned for them are not defined by the core protocol.
  4196. PolyText8
  4197.            drawable: DRAWABLE
  4198.            gc: GCONTEXT
  4199.            x, y: INT16
  4200.            items: LISTofTEXTITEM8
  4201.  
  4202.            where
  4203.                    TEXTITEM8: TEXTELT8 or FONT
  4204.                    TEXTELT8: [delta: INT8
  4205.                               string: STRING8]
  4206.  
  4207.            Errors: Drawable, GContext, Match, Font
  4208.  
  4209.            The x and y coordinates are relative to drawable's origin,
  4210.            and specify the baseline starting position (the initial
  4211.            character origin). Each text item is processed in turn.  A
  4212.            font item causes the font to be stored in gc, and to be
  4213.            used for subsequent text; switching among fonts with
  4214.            differing draw-directions is permitted.  A text element
  4215.            delta specifies an additional change in the position along
  4216.            the x axis before the string is drawn; the delta is always
  4217.            added to the character origin (not added or subtracted based
  4218.            on the draw-direction of the current font).  Each character
  4219.            image, as defined by the a font in gc, is treated as an
  4220.            additional mask for a fill operation on the drawable.
  4221.  
  4222.            All contained FONTs are always transmitted most significant
  4223.            byte first.
  4224.  
  4225.            If a Font error is generated for an item, the previous items
  4226.            may have been drawn.
  4227.  
  4228.            For fonts defined with two-byte matrix indexing, each STRING8
  4229.            byte is interpreted as a byte2 value of a CHAR2B with a byte1
  4230.            value of zero.
  4231.  
  4232.            GC components: alu-function, plane-mask, fill-style, font,
  4233.            subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
  4234.  
  4235.            GC mode-dependent components: foreground, tile, stipple,
  4236.            tile-stipple-x-origin, tile-stipple-y-origin
  4237.  
  4238. PolyText16
  4239.            drawable: DRAWABLE
  4240.            gc: GCONTEXT
  4241.            x, y: INT16
  4242.  
  4243.  
  4244.  
  4245. M.I.T.                                                         [Page 72]
  4246.  
  4247. RFC 1013                                                       June 1987
  4248.  
  4249.  
  4250.            items: LISTofTEXTITEM16
  4251.  
  4252.            where
  4253.                    TEXTITEM16: TEXTELT16 or FONT
  4254.                    TEXTELT16: [delta-x: INT8
  4255.                                string: STRING16]
  4256.  
  4257.            Errors: Drawable, GContext, Match, Font
  4258.  
  4259.            Just like PolyText8, except two-byte (or 16-bit) characters
  4260.            are used. For fonts defined with linear indexing rather than
  4261.            two-byte matrix indexing, the server will interpret each
  4262.            CHAR2B as a 16-bit number that has been transmitted most
  4263.            significant byte first (i.e., byte1 of the CHAR2B is taken
  4264.            as the most significant byte).
  4265.  
  4266. ImageText8
  4267.            drawable: DRAWABLE
  4268.            gc: GCONTEXT
  4269.            x, y: INT16
  4270.            string: STRING8
  4271.  
  4272.            Errors: Drawable, GContext, Match
  4273.  
  4274.            The x and y coordinates are relative to drawable's origin,
  4275.            and specify the baseline starting position (the initial
  4276.            character origin). The effect is to first fill a
  4277.            destination rectangle with the background pixel defined in
  4278.            gc, and then paint the text with the foreground pixel.
  4279.            The upper left corner of the filled rectangle is at
  4280.                    [x + overall-left, y - font-ascent]
  4281.            the width is
  4282.                    overall-right - overall-left
  4283.            and the height is
  4284.                    font-ascent + font-descent
  4285.            where overall-left, overall-right, font-ascent, and
  4286.            as font-descent are would be returned by a QueryTextExtents
  4287.            call using gc and string.
  4288.  
  4289.            The alu-function and fill-style defined in gc are ignored for
  4290.            this request; the effective alu-function is Copy and the
  4291.            effective fill-style Solid.
  4292.  
  4293.            For fonts defined with two-byte matrix indexing, each STRING8
  4294.            byte is interpreted as a byte2 value of a CHAR2B with a byte1
  4295.            value of zero.
  4296.  
  4297.            GC components: plane-mask, foreground, background, font,
  4298.            subwindow-mode, clip-x-origin, clip-y-origin, clip-mask
  4299.  
  4300.  
  4301.  
  4302.  
  4303.  
  4304. M.I.T.                                                         [Page 73]
  4305.  
  4306. RFC 1013                                                       June 1987
  4307.  
  4308.  
  4309. ImageText16
  4310.            drawable: DRAWABLE
  4311.            gc: GCONTEXT
  4312.            x, y: INT16
  4313.            string: STRING16
  4314.  
  4315.            Errors: Drawable, GContext, Match
  4316.  
  4317.            Just like ImageText8, except two-byte (or 16-bit) characters
  4318.            are used. For fonts defined with linear indexing rather than
  4319.            two-byte matrix indexing, the server will interpret each
  4320.            CHAR2B as a 16-bit number that has been transmitted most
  4321.            significant byte first (i.e., byte1 of the CHAR2B is taken as
  4322.            the most significant byte).
  4323.  
  4324. CreateColormap
  4325.            mid: COLORMAP
  4326.            visual: VISUALID
  4327.            window: WINDOW
  4328.            alloc: {None, All}
  4329.  
  4330.            Errors: IDChoice, Window, Value, Match, Alloc
  4331.  
  4332.            Creates a colormap of the specified visual type for the
  4333.            screen on which the window resides, and associates the
  4334.            identifier mid with it.  The visual type must be one
  4335.            supported by the screen, and cannot be of class TrueColor
  4336.            (else a Match error).  The initial values of the colormap
  4337.            entries are undefined for classes GrayScale, PseudoColor,
  4338.            and DirectColor; for StaticGray, StaticColor, and
  4339.            TrueColor, the entries will have defined values, but those
  4340.            values are specific to the visual and are not defined by
  4341.            the core protocol.  For StaticGray, StaticColor, and
  4342.            TrueColor, alloc must be specified as None (else a Match
  4343.            error). For the other classes, if alloc is None, the
  4344.            colormap initially has no allocated entries, and clients
  4345.            can allocate entries.  If alloc is All, then the entire
  4346.            colormap is "allocated" writable, but entries cannot be
  4347.            freed with FreeColors, and no relationships among entries
  4348.            is defined; the client must understand whether the colormap
  4349.            is GrayScale, PseudoColor, or DirectColor to know how to
  4350.            store into entries.
  4351.  
  4352. FreeColormap
  4353.            cmap: COLORMAP
  4354.  
  4355.            Errors: Colormap
  4356.  
  4357.            Deletes the association between the resource id and the
  4358.            colormap.  If the colormap is an installed map for a screen,
  4359.            it is uninstalled (see UninstallColormap).  If the colormap
  4360.  
  4361.  
  4362.  
  4363. M.I.T.                                                         [Page 74]
  4364.  
  4365. RFC 1013                                                       June 1987
  4366.  
  4367.  
  4368.            is defined as the colormap for a window (via CreateWindow or
  4369.            ChangeWindowAttributes), the colormap for the window is
  4370.            changed to None, and a ColormapNotify event is generated.The
  4371.            colors displayed for a window with a colormap of None are not
  4372.            defined by the protocol.
  4373.  
  4374.            Has no effect on a default colormap for a screen.
  4375.  
  4376.  
  4377. CopyColormapAndFree
  4378.            mid, src-cmap: COLORMAP
  4379.  
  4380.            Errors: Colormap, Alloc
  4381.  
  4382.            Creates a colormap for the same screen as src-cmap, and
  4383.            associates identifier mid with it.  Moves all of the client's
  4384.            existing allocations from src-cmap to the new colormap, and
  4385.            frees those entries in src-cmap. Values in other entries in
  4386.            the new colormap are undefined.
  4387.  
  4388. InstallColormap
  4389.            cmap: COLORMAP
  4390.  
  4391.            Errors: Colormap
  4392.  
  4393.            Makes this colormap an installed map for its screen.  All
  4394.            windows associated with this colormap immediately display
  4395.            with true colors.  As a side-effect, previously installed
  4396.            colormaps may be uninstalled, and other windows may display
  4397.            with false colors.  Which colormaps get uninstalled is
  4398.            server dependent, except that it is guaranteed that the
  4399.            M-1 most recently client-installed colormaps will not be
  4400.            uninstalled, where M is the min-installed-maps specified
  4401.            for the screen in the connection setup.
  4402.  
  4403.            If cmap is not already an installed map, a ColormapNotify
  4404.            event is generated on every window having cmap as an
  4405.            attribute.  If a colormap is uninstalled as a result of
  4406.            the install, a ColormapNotify event is generated on every
  4407.            window having that colormap as an attribute.
  4408.  
  4409.            Initially only the default colormap for a screen is
  4410.            installed.
  4411.  
  4412. UninstallColormap
  4413.            cmap: COLORMAP
  4414.  
  4415.            Errors: Colormap
  4416.  
  4417.            If cmap is an installed map for its screen, one or more
  4418.            colormaps are installed in its place; the choice is server
  4419.  
  4420.  
  4421.  
  4422. M.I.T.                                                         [Page 75]
  4423.  
  4424. RFC 1013                                                       June 1987
  4425.  
  4426.  
  4427.            dependent, pexcept that if the screen's default colormap is
  4428.            not installed and can be installed (without forcing other
  4429.            colormaps out), then the default colormap is used.
  4430.  
  4431.            If cmap is an installed map, a ColormapNotify event is
  4432.            generated on every window having this colormap as an
  4433.            attribute.  If a colormap is installed as a result of the
  4434.            uninstall, a ColormapNotify event is generated on every
  4435.            window having that colormap as an attribute.
  4436.  
  4437. ListInstalledColormaps
  4438.            window: WINDOW
  4439.        =>
  4440.            cmaps: LISTofCOLORMAP
  4441.  
  4442.            Errors: Window
  4443.  
  4444.            Returns a list of the currently installed colormaps for the
  4445.            screen of the specified window.
  4446.  
  4447. AllocColor
  4448.            cmap: COLORMAP
  4449.            red, green, blue: CARD16
  4450.        =>
  4451.            pixel: CARD32
  4452.            red, green, blue: CARD16
  4453.  
  4454.            Errors: Colormap, Alloc
  4455.  
  4456.            Allocates a read-only colormap entry corresponding to the
  4457.            closest RGB values provided by the hardware.  Returns the
  4458.            pixel and the RGB values actually used.
  4459.  
  4460. AllocNamedColor
  4461.            cmap: COLORMAP
  4462.            name: STRING8
  4463.        =>
  4464.            pixel: CARD32
  4465.            exact-red, exact-green, exact-blue: CARD16
  4466.            screen-red, screen-green, screen-blue: CARD16
  4467.  
  4468.            Errors: Colormap, Name, Alloc
  4469.  
  4470.            Looks up the named color with respect to the screen
  4471.            associated with the colormap, then does an AllocColor on
  4472.            cmap.  The name should use the  ASCII encoding, and
  4473.            upper/lower case does not matter. The exact RGB values
  4474.            specify the "true" values for the color, and the screen
  4475.            values specify the values actually used in the colormap.
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481. M.I.T.                                                         [Page 76]
  4482.  
  4483. RFC 1013                                                       June 1987
  4484.  
  4485.  
  4486. AllocColorCells
  4487.            cmap: COLORMAP
  4488.            colors, planes: CARD16
  4489.            contiguous: BOOL
  4490.        =>
  4491.            pixels, masks: LISTofCARD32
  4492.  
  4493.            Errors: Colormap, Value, Alloc
  4494.  
  4495.            The number of colors must be positive, the number of planes
  4496.            non-negative.  If C colors and P planes are requested, then C
  4497.            pixels  and P masks are returned.  No mask will have any bits
  4498.            in common with any other mask, or with any of the pixels.  By
  4499.            ORing together masks and pixels, C*(2^P) distinct pixels can
  4500.            be produced; all of these are allocated writable by the
  4501.            request.  For GrayScale or PseudoColor, each mask will have
  4502.            exactly one bit, and for DirectColor each will have exactly
  4503.            three bits.   If contiguous is True, then if all masks are
  4504.            ORed together, a single contiguous set of bits will be formed
  4505.            for GrayScale or PseudoColor, and three contiguous sets of
  4506.            bits (one within each pixel subfield) for DirectColor.  The
  4507.            RGB values of the allocated entries are undefined.
  4508.  
  4509. AllocColorPlanes
  4510.            cmap: COLORMAP
  4511.            colors, reds, greens, blues: CARD16
  4512.            contiguous: BOOL
  4513.        =>
  4514.            pixels: LISTofCARD32
  4515.            red-mask, green-mask, blue-mask: CARD32
  4516.  
  4517.            Errors; Colormap, Value, Alloc
  4518.  
  4519.            The number of colors must be positive, the reds, greens, and
  4520.            blues non-negative.  If C colors, R reds, G greens, and B
  4521.            blues are requested, then C pixels are returned, and the
  4522.            masks have R, G, and B bits set respectively.  If contiguous
  4523.            is True, then each mask will have a contiguous set of bits.
  4524.            No mask will have any bits in common with any other mask, or
  4525.            with any of the pixels.  For DirectColor, each mask will lie
  4526.            within the corresponding pixel subfield.  By ORing together
  4527.            subsets of masks with pixels, C*(2^(R+G+B)) distinct pixels
  4528.            can be produced; all of these are allocated by the request.
  4529.            The initial RGB values of the allocated entries are
  4530.            undefined. In the colormap there are only C*(2^R)
  4531.            independent red entries, C*(2^G) independent green entries,
  4532.            and C*(2^B) independent blue entries.  This is true even for
  4533.            PseudoColor.  When the colormap entry for a pixel value is
  4534.            changed using StoreColors or StoreNamedColor, the pixel is
  4535.            decomposed according to the masks and the corresponding
  4536.            independent entries are updated.
  4537.  
  4538.  
  4539.  
  4540. M.I.T.                                                         [Page 77]
  4541.  
  4542. RFC 1013                                                       June 1987
  4543.  
  4544.  
  4545. FreeColors
  4546.            cmap: COLORMAP
  4547.            pixels: LISTofCARD32
  4548.            plane-mask: CARD32
  4549.  
  4550.            Errors: Colormap, Access, Value
  4551.  
  4552.            The plane-mask should not have any bits in common with any of
  4553.            the pixels.  The set of all pixels is produced by ORing
  4554.            together subsets of plane-mask with the pixels.  The request
  4555.            frees all of these pixels. Note that freeing an individual
  4556.            pixel obtained from AllocColorPlanes may not actually allow
  4557.            it to be reused until all of its "related" pixels are also
  4558.            freed.
  4559.  
  4560.            All specified pixels that are allocated by the client in
  4561.            cmap are freed, even if one or more pixels produce an error.
  4562.            A Value error is generated if a specified pixel is not a
  4563.            valid index into cmap, and an Access error is generated if a
  4564.            specified pixel is not allocated by the client (i.e., is
  4565.            unallocated or is only allocated by another client). If more
  4566.            than one pixel is in error, which one is reported is
  4567.            arbitrary.
  4568.  
  4569. StoreColors
  4570.            cmap: COLORMAP
  4571.            items: LISTofCOLORITEM
  4572.  
  4573.            where
  4574.                    COLORITEM: [pixel: CARD32
  4575.                                do-red, do-green, do-blue: BOOL
  4576.                                red, green, blue: CARD16]
  4577.  
  4578.            Errors: Colormap, Access, Value
  4579.  
  4580.            Changes the colormap entries of the specified pixels.  The
  4581.            do-red, do-green, and do-blue fields indicate which
  4582.            components should actually be changed.  If the colormap is an
  4583.            installed  map for its screen, the changes are visible
  4584.            immediately.
  4585.  
  4586.            All specified pixels that are allocated writable in cmap (by
  4587.            any client) are changed, even if one or more pixels produce
  4588.            an error.  A Value error is generated if a specified pixel is
  4589.            not a valid index into cmap, and an Access error is generated
  4590.            if a specified pixel is unallocated or is allocated
  4591.            read-only.  If more than one pixel is in error, which one is
  4592.            reported is arbitrary.
  4593.  
  4594. StoreNamedColor
  4595.            cmap: COLORMAP
  4596.  
  4597.  
  4598.  
  4599. M.I.T.                                                         [Page 78]
  4600.  
  4601. RFC 1013                                                       June 1987
  4602.  
  4603.  
  4604.            pixel: CARD32
  4605.            name: STRING8
  4606.            do-red, do-green, do-blue: BOOL
  4607.  
  4608.            Errors: Colormap, Name, Access, Value
  4609.  
  4610.            Looks up the named color with respect to the screen
  4611.            associated with cmap, then does a StoreColors in cmap.  The
  4612.            name should use the ASCII encoding, and upper/lower case
  4613.            does not matter.
  4614.  
  4615. QueryColors
  4616.            cmap: COLORMAP
  4617.            pixels: LISTofCARD32
  4618.        =>
  4619.            colors: LISTofRGB
  4620.  
  4621.            where
  4622.                    RGB: [red, green, blue: CARD16]
  4623.  
  4624.            Errors: Colormap, Value
  4625.  
  4626.            Returns the color values stored in cmap for the specified
  4627.            pixels.  The values returned for an unallocated entry are
  4628.            undefined. A Value error is generated if a pixel is not a
  4629.            valid index into cmap.  If more than one pixel is in error,
  4630.            which one is reported is arbitrary.
  4631.  
  4632. LookupColor
  4633.            cmap: COLORMAP
  4634.            name: STRING8
  4635.        =>
  4636.            exact-red, exact-green, exact-blue: CARD16
  4637.            screen-red, screen-green, screen-blue: CARD16
  4638.  
  4639.            Errors: Colormap, Name
  4640.  
  4641.            Looks up the string name of a color with respect to the
  4642.            screen associated with cmap, and returns both the exact the
  4643.            color values and the closest values provided by the hardware.
  4644.            The name should use the ASCII encoding, and upper/lower
  4645.            case does not matter.
  4646.  
  4647. CreateCursor
  4648.            cid: CURSOR
  4649.            source: PIXMAP
  4650.            mask: PIXMAP or None
  4651.            fore-red, fore-green, fore-blue: CARD16
  4652.            back-red, back-green, back-blue: CARD16
  4653.            x, y: CARD16
  4654.  
  4655.  
  4656.  
  4657.  
  4658. M.I.T.                                                         [Page 79]
  4659.  
  4660. RFC 1013                                                       June 1987
  4661.  
  4662.  
  4663.            Errors: IDChoice, Bitmap, Match, Value, Alloc
  4664.  
  4665.            Creates a cursor and associates identifier cid with it.
  4666.            Foreground and background RGB values must be specified, even
  4667.            if the server only has a monochrome screen.  The foreground
  4668.            is used for the one bits in the source, and the background is
  4669.            used for the zero bits.  Both source and mask (if specified)
  4670.            must have depth one (else a Match error), but can have any
  4671.            root.  The mask pixmap defines the shape of the cursor; that
  4672.            is, the one bits in the mask define which source pixels will
  4673.            be displayed.  If no mask is given, all pixels of the source
  4674.            are displayed.  The mask, if present, must be the same size
  4675.            as source (else a Match error).  The x and y coordinates
  4676.            define the hotspot, relative to the source's origin, and must
  4677.            be a point within the source (else a Match error).
  4678.  
  4679.            The components of the cursor may be transformed arbitrarily
  4680.            to meet display limitations.
  4681.  
  4682.            The pixmaps can be freed immediately if no further explicit
  4683.            references to them are to be made.
  4684.  
  4685.            Subsequent drawing in the source or mask pixmap has an
  4686.            undefined effect on the cursor; the server might or might
  4687.            not make a copy of the pixmap.
  4688.  
  4689. CreateGlyphCursor
  4690.            cid: CURSOR
  4691.            source-font: FONT
  4692.            mask-font: FONT or None
  4693.            source-char, mask-char: CARD16
  4694.            fore-red, fore-green, fore-blue: CARD16
  4695.            back-red, back-green, back-blue: CARD16
  4696.  
  4697.            Errors: IDChoice, Font, Value, Alloc
  4698.  
  4699.            Similar to CreateCursor, but the source and mask bitmaps are
  4700.            obtained from the specified font glyphs.  The mask font and
  4701.            character are optional.  The origin of the source glyph
  4702.            defines the hotspot, and the mask is positioned such that
  4703.            the origins are coincident.  The source and mask need not
  4704.            have the same bounding box metrics.  If no mask is given,
  4705.            all pixels of the source are displayed.  Note that
  4706.            source-char and mask-char are CARD16 (not CHAR2B); for
  4707.            two-byte matrix fonts, the 16-bit value should be formed
  4708.            with byte1 in the most significant byte and byte2 in the
  4709.            least significant byte.
  4710.  
  4711. FreeCursor
  4712.            cursor: CURSOR
  4713.  
  4714.  
  4715.  
  4716.  
  4717. M.I.T.                                                         [Page 80]
  4718.  
  4719. RFC 1013                                                       June 1987
  4720.  
  4721.  
  4722.            Errors: Cursor
  4723.  
  4724.            Deletes the association between the resource id and the
  4725.            cursor.  The cursor storage will be freed when no other
  4726.            resource references it.
  4727.  
  4728. RecolorCursor
  4729.            cursor: CURSOR
  4730.            fore-red, fore-green, fore-blue: CARD16
  4731.            back-red, back-green, back-blue: CARD16
  4732.  
  4733.            Errors: Cursor
  4734.  
  4735.            Changes the color of a cursor.  If the cursor is being
  4736.            displayed on a screen, the change is visible immediately.
  4737.  
  4738. QueryBestSize
  4739.            class: {Cursor, Tile, Stipple}
  4740.            drawable: DRAWABLE
  4741.            width, height: CARD16
  4742.        =>
  4743.            width, height: CARD16
  4744.  
  4745.            Errors: Drawable, Value, Match
  4746.  
  4747.            Returns the "best" size that is "closest" to the argument
  4748.            size.  For Cursor, this is the largest size that can be
  4749.            fully displayed.  For Tile, this is the size that can be
  4750.            tiled "fastest".  For Stipple, this is the size that can
  4751.            be stippled "fastest".
  4752.  
  4753.            For Cursor, the drawable indicates the desired screen.  For
  4754.            Tile and Stipple, the drawable indicates screen, and also
  4755.            possibly window class and depth; an InputOnly window cannot
  4756.            be used as the drawable for Tile or Stipple (else a Match
  4757.            error).
  4758.  
  4759. QueryExtension
  4760.            name: STRING8
  4761.        =>
  4762.            present: BOOL
  4763.            major-opcode: CARD8
  4764.            first-event: CARD8
  4765.            first-error: CARD8
  4766.  
  4767.            Determines if the named extension is present.  If so, the
  4768.            major opcode for the extension is returned, if it has one,
  4769.            otherwise zero is returned.  Any minor opcode and the request
  4770.            formats are specific to the extension.  If the extension
  4771.            involves additional event types, the base event type code is
  4772.            returned, otherwise zero is returned.  The format of the
  4773.  
  4774.  
  4775.  
  4776. M.I.T.                                                         [Page 81]
  4777.  
  4778. RFC 1013                                                       June 1987
  4779.  
  4780.  
  4781.            events is specific to the extension.  If the extension
  4782.            involves additional error codes, the base error code is
  4783.            returned, otherwise zero is returned.  The format of
  4784.            additional data in the errors is specific to the extension.
  4785.  
  4786.            The extension name should be in the ASCII encoding, and
  4787.            upper/lower case matters.
  4788.  
  4789. ListExtensions
  4790.        =>
  4791.            names: LISTofSTRING8
  4792.  
  4793.            Returns a list of all extensions supported by the server.
  4794.  
  4795. SetKeyboardMapping
  4796.            map: LISTofCARD8
  4797.        =>
  4798.            status: {Success, Busy}
  4799.  
  4800.            Errors: Value
  4801.  
  4802.            Sets the mapping of the keyboard.  Elements of the list are
  4803.            indexed starting from one.  The list must be of length 255.
  4804.            The index is a "core" keycode, and the element of the list
  4805.            defines the "effective" keycode.
  4806.  
  4807.            A zero element disables a key, no elements can have values 1
  4808.            through 7, and no two elements (with index larger than 7) can
  4809.            have the same non-zero value.  If the keyboard does not
  4810.            really generate a given keycode, specifying a non-zero value
  4811.            for that core keycode has no effect.
  4812.  
  4813.            Elements 6 and 7 of the map must always be zero.  The first
  4814.            five elements are special:  they specify the keycodes (if
  4815.            any) that correspond to the Mod1 through Mod5 modifiers.
  4816.            Setting one of these entries to zero disables use of that
  4817.            modifier bit.  No two of the firstfive elements can have the
  4818.            same non-zero value.
  4819.  
  4820.            A server can impose restrictions on how keyboards get
  4821.            remapped, e.g., if certain keys do not generate up
  4822.            transitions in hardware.
  4823.  
  4824.            If any of the keys or modifiers to be altered are currently
  4825.            in the down state, the status reply is Busy and the mapping
  4826.            is not changed.
  4827.  
  4828. GetKeyboardMapping
  4829.        =>
  4830.            map: LISTofCARD8
  4831.  
  4832.  
  4833.  
  4834.  
  4835. M.I.T.                                                         [Page 82]
  4836.  
  4837. RFC 1013                                                       June 1987
  4838.  
  4839.  
  4840.            Errors: Value
  4841.  
  4842.            Returns the current mapping of the keyboard.  Elements of the
  4843.            list are indexed starting from one.  The length of the list
  4844.            is 255.
  4845.  
  4846.            The nominal mapping for a keyboard is almost the identity
  4847.            mapping, except that map[i]=0 for keycodes that have no
  4848.            corresponding physical key, and the first five entries
  4849.            indicate the keycodes (if any) corresponding to the Mod1
  4850.            through Mod5 modifier bits.
  4851.  
  4852. ChangeKeyboardControl
  4853.            value-mask: BITMASK
  4854.            value-list: LISTofVALUE
  4855.  
  4856.            Errors: Match Value
  4857.  
  4858.            Controls various aspects of the keyboard.  The value-mask and
  4859.            value-list specify which controls are to be changed.  The
  4860.            possible values are:
  4861.  
  4862.                key-click-percent: INT8
  4863.                bell-percent: INT8
  4864.                bell-pitch: INT16
  4865.                bell-duration: INT16
  4866.                led: CARD8
  4867.                led-mode: {On, Off}
  4868.                key: KEYCODE
  4869.                auto-repeat-mode: {On, Off, Default}
  4870.  
  4871.            Key-click-percent sets the volume for key clicks between 0
  4872.            (off) and 100 (loud) inclusive, if possible.  Setting to -1
  4873.            restores the default. Other negative values generate a Value
  4874.            error.
  4875.  
  4876.            Bell-percent sets the base volume for the bell between 0
  4877.            (off) and 100 (loud) inclusive, if possible.  Setting to -1
  4878.            restores the default. Other negative values generate a Value
  4879.            error.
  4880.  
  4881.            Bell-pitch sets the pitch (specified in Hz) of the bell, if
  4882.            possible. Setting to -1 restores the default.  Other
  4883.            negative values generate a Value error.
  4884.  
  4885.            Bell-duration sets the duration (specified in milliseconds)
  4886.            of the bell, if possible.  Setting to -1 restores the
  4887.            default.  Other negative values generate a Value error.
  4888.  
  4889.            If both led-mode and led are specified, then the state of
  4890.            that LED is changed, if possible.  If only led-mode is
  4891.  
  4892.  
  4893.  
  4894. M.I.T.                                                         [Page 83]
  4895.  
  4896. RFC 1013                                                       June 1987
  4897.  
  4898.  
  4899.            specified, then the state of all LEDs are changed, if
  4900.            possible.  At most 32 LEDs are supported, numbered from one.
  4901.            It is a Match error if an led is specified without an
  4902.            led-mode.
  4903.  
  4904.            If both auto-repeat-mode and key are specified, then the
  4905.            auto-repeat mode of that key is changed, if possible.  If
  4906.            only auto-repeat-mode is specified, then the global
  4907.            auto-repeat mode for the entire keyboard is changed, if
  4908.            possible, without affecting the per-key settings.  It is
  4909.            a Match error if a key is specified without an
  4910.            auto-repeat-mode.
  4911.  
  4912.            A bell generator connected with the console but not directly
  4913.            on the keyboard is treated as if it were part of the
  4914.            keyboard.
  4915.  
  4916.            The order in which controls are verified and altered is
  4917.            server dependent.  If an error is generated, a subset of the
  4918.            controls may have been altered.
  4919.  
  4920. GetKeyboardControl
  4921.        =>
  4922.            key-click-percent: CARD8
  4923.            bell-percent: CARD8
  4924.            bell-pitch: CARD16
  4925.            bell-duration: CARD16
  4926.            led-mask: CARD32
  4927.            global-auto-repeat: {On, Off}
  4928.            auto-repeats: LISTofCARD8
  4929.  
  4930.            Errors: Match
  4931.  
  4932.            Returns the current control values for the keyboard.  For the
  4933.            LEDs, the least significant bit of led-mask corresponds to
  4934.            LED one, and each one bit in led-mask indicates an LED that
  4935.            is lit. Auto-repeats is a bit vector; each one bit indicates
  4936.            that auto-repeat is enabled for the corresponding key.  The
  4937.            vector is represented as 32 bytes.  Byte N (from 0) contains
  4938.            the bits for keys 8N to 8N+7, with the least significant bit
  4939.            in the byte representing key 8N.
  4940.  
  4941. Bell
  4942.            percent: INT8
  4943.  
  4944.            Errors: Match, Value
  4945.  
  4946.            Rings the bell on the keyboard at the specified volume
  4947.            relative to the base volume for the keyboard, if possible.
  4948.            Percent, which can range from -100 to 100 inclusive, is added
  4949.            to the base volume, and the sum limited to the range 0 to 100
  4950.  
  4951.  
  4952.  
  4953. M.I.T.                                                         [Page 84]
  4954.  
  4955. RFC 1013                                                       June 1987
  4956.  
  4957.  
  4958.            inclusive.
  4959.  
  4960. SetPointerMapping
  4961.            map: LISTofCARD8
  4962.        =>
  4963.            status: {Success, Busy}
  4964.  
  4965.            Errors: Value
  4966.  
  4967.            Sets the mapping of the pointer.  Elements of the list are
  4968.            indexed starting from one.  The length of the list must be
  4969.            the same as GetPointerMapping would return.  The index is a
  4970.            "core" button number, and the element of the list defines
  4971.            the "effective" number.
  4972.  
  4973.            A zero element disables a button, and elements are not
  4974.            restricted in   value by the number of physical buttons, but
  4975.            no two elements can have the same non-zero value.
  4976.  
  4977.            If any of the buttons to be altered are currently in the
  4978.            down state,the status reply is Busy and the mapping is not
  4979.            changed.
  4980.  
  4981. GetPointerMapping
  4982.        =>
  4983.            map: LISTofCARD8
  4984.  
  4985.            Errors: Value
  4986.  
  4987.            Returns the current mapping of the pointer.  Elements of the
  4988.            list are indexed starting from one.  The length of the list
  4989.            indicates the number of physical buttons.
  4990.  
  4991.            The nominal mapping for a pointer is the identity mapping;
  4992.            map[i]=i.
  4993.  
  4994. ChangePointerControl
  4995.            do-acceleration, do-threshold: BOOL
  4996.            acceleration-numerator, acceleration-denominator: INT16
  4997.            threshold: INT16
  4998.  
  4999.            Errors: Match, Value
  5000.  
  5001.            Defines how the pointer moves.  The acceleration is a
  5002.            multiplier for movement, expressed as a fraction.  For
  5003.            example, specifying 3/1 means the pointer moves three times
  5004.            as fast as normal. The fraction may be rounded arbitrarily
  5005.            by the server.  Acceleration only takes effect if the
  5006.            pointer moves more than threshold pixels at once, and only
  5007.            applies to the amount beyond the threshold.  Setting a
  5008.            value to -1 restores the default. Other negative values
  5009.  
  5010.  
  5011.  
  5012. M.I.T.                                                         [Page 85]
  5013.  
  5014. RFC 1013                                                       June 1987
  5015.  
  5016.  
  5017.            generate a Value error, as does a zero value for
  5018.            acceleration-denominator.
  5019.  
  5020. GetPointerControl
  5021.        =>
  5022.            acceleration-numerator, acceleration-denominator: CARD16
  5023.            threshold: CARD16
  5024.  
  5025.            Errors: Match
  5026.  
  5027.            Returns the current acceleration and threshold for the
  5028.            pointer.
  5029.  
  5030. SetScreenSaver
  5031.            timeout, interval: INT16
  5032.            prefer-blanking: {Yes, No, Default}
  5033.            allow-exposures: {Yes, No, Default}
  5034.  
  5035.            Errors: Value
  5036.  
  5037.            Timeout and interval are specified in minutes; setting a
  5038.            value to -1 restores the default.  Other negative values
  5039.            generate a Value error. If the timeout value is zero,
  5040.            screen-saver is disabled.  If the timeout value is
  5041.            non-zero, screen-saver is enabled.  Once screen-saver
  5042.            is enabled, if no input from the keyboard or pointer is
  5043.            generated for timeout minutes, screen-saver is activated.
  5044.            For each screen, if blanking is preferred and the hardware
  5045.            supports video blanking, the screen will simply go blank.
  5046.            Otherwise, if either exposures are allowed or the screen
  5047.            can be regenerated without sending exposure events to
  5048.            clients, the screen is tiled with the root window
  5049.            background tile, randomly re-origined each interval
  5050.            minutes if the interval value is non-zero.  Otherwise, the
  5051.            state of the screen does not change and screen-saver is not
  5052.            activated.  Screen-saver is deactivated, and all screen
  5053.            states are restored, at the next keyboard or pointer input
  5054.            or at the next ForceScreenSaver with mode Reset.
  5055.  
  5056. GetScreenSaver
  5057.        =>
  5058.            timeout, interval: CARD16
  5059.            prefer-blanking: {Yes, No}
  5060.            allow-exposures: {Yes, No}
  5061.  
  5062.            Returns the current screen-saver control values.
  5063.  
  5064. ForceScreenSaver
  5065.            mode: {Activate, Reset}
  5066.  
  5067.            If the mode is Activate and screen-saver is currently
  5068.  
  5069.  
  5070.  
  5071. M.I.T.                                                         [Page 86]
  5072.  
  5073. RFC 1013                                                       June 1987
  5074.  
  5075.  
  5076.            deactivated, then screen-saver is activated (even if
  5077.            screen-saver has been disabled with a timeout value of zero).
  5078.            If the mode is Reset and screen-saver is currently enabled,
  5079.            then screen-saver is deactivated (if it was activated), and
  5080.            then the activation timer is reset to its initial state, as
  5081.            if device input had just been received.
  5082.  
  5083. ChangeHosts
  5084.            mode: {Insert, Delete}
  5085.            host: HOST
  5086.  
  5087.            Errors: Access, Value
  5088.  
  5089.            Adds or removes the specified host from the access control
  5090.            list.  When the access control mechanism is enabled and a
  5091.            host attempts to establish a connection to the server, the
  5092.            host must be in this list or the server will refuse the
  5093.            connection.
  5094.  
  5095.            The client must reside on the same host as the server, and/or
  5096.            have been granted permission in the initial authorization at
  5097.            connection setup.
  5098.  
  5099.            An initial access control list can be specified, typically
  5100.            by naming a file that the server reads at startup and reset.
  5101.  
  5102. ListHosts
  5103.        =>
  5104.            mode: {Enabled, Disabled}
  5105.            hosts: LISTofHOST
  5106.  
  5107.            Returns the hosts on the access control list, and whether use
  5108.            of the list at connection setup is currently enabled or
  5109.            disabled.
  5110.  
  5111.            Each HOST is padded to a multiple of four bytes.
  5112.  
  5113. ChangeAccessControl
  5114.            mode: {Enable, Disable}
  5115.  
  5116.            Errors: Value, Access
  5117.  
  5118.            Enables or disables the use of the access control list at
  5119.            connection setups.
  5120.  
  5121.            The client must reside on the same host as the server, and/or
  5122.            have been granted permission in the initial authorization at
  5123.            connection setup.
  5124.  
  5125. ChangeCloseDownMode
  5126.            mode: {Destroy, RetainPermanent, RetainTemporary}
  5127.  
  5128.  
  5129.  
  5130. M.I.T.                                                         [Page 87]
  5131.  
  5132. RFC 1013                                                       June 1987
  5133.  
  5134.  
  5135.            Errors: Value
  5136.  
  5137.            Defines what will happen to the client's resources at
  5138.            connection close. A connection starts in Destroy mode.  The
  5139.            meaning of the close-down mode is described in Section 11.
  5140.  
  5141. KillClient
  5142.            resource: CARD32 or AllTemporary
  5143.  
  5144.            Errors: Value
  5145.  
  5146.            If a valid resource is specified, forces a close-down of the
  5147.            client that created the resource.  If the client has already
  5148.            terminated in either RetainPermanent or RetainTemporary mode,
  5149.            all of the client's resources are destroyed (see Section 11).
  5150.            If AllTemporary is specified, then the resources of all
  5151.            clients that have terminated in RetainTemporary are
  5152.            destroyed.
  5153.  
  5154. NoOperation
  5155.            This request has no arguments and no results, but the request
  5156.            length field can be non-zero, allowing the request to be any
  5157.            multiple of 4 bytes in length.  The bytes contained in the
  5158.            request are uninterpreted by the server.
  5159.  
  5160.            This request can be used in its minimum 4 byte form as
  5161.            "padding" where necessary by client libraries that find it
  5162.            convenient to force requests to begin on 64-bit boundaries.
  5163.  
  5164.  
  5165. SECTION 11.  CONNECTION CLOSE
  5166.  
  5167. What happens at connection close:
  5168.  
  5169.            All event selections made by the client are discarded.  If
  5170.            the client has the pointer actively grabbed, an
  5171.            UngrabPointer is performed.  If the client has the keyboard
  5172.            actively grabbed,  an UngrabKeyboard is performed.  All
  5173.            passive grabs by the client are eleased.  If the client has
  5174.            the server grabbed, and UngrabServer is performed.  If
  5175.            close-down mode (see ChangeCloseDownMode) is
  5176.            RetainPermanent or RetainTemporary, then all resources
  5177.            (including colormap entries)    allocated by the client are
  5178.            marked as "permanent" or "temporary", respectively (but
  5179.            this does not prevent other clients from explicitly
  5180.            destroying them).  If the mode is Destroy, then all of the
  5181.            client's resources are destroyed as described below.
  5182.  
  5183. What happens when a client's resources are destroyed:
  5184.  
  5185.            For each window in the client's save-set, if the window
  5186.  
  5187.  
  5188.  
  5189. M.I.T.                                                         [Page 88]
  5190.  
  5191. RFC 1013                                                       June 1987
  5192.  
  5193.  
  5194.            created by the client, that save-set window is reparented to
  5195.            the closest ancestor such that the save-set window is not an
  5196.            inferior of a window created by the client.  If the save-set
  5197.            window is unmaped, a MapWindow request is performed on it.
  5198.            After save-set processing, all windows created by the client
  5199.            are destroyed.  For each non-window resource created by the
  5200.            client, the appropriate Free request is performed.  All
  5201.            colors and colormap entries allocated by the client are
  5202.            freed.
  5203.  
  5204. What happens when the last connection to a server closes:
  5205.  
  5206.            A server goes through a cycle, of having no connections and
  5207.            having some connections.  At every transition to the state
  5208.            of having no connections, the server "resets" its state, as
  5209.            if it had just been started.  This starts by destroying all
  5210.            lingering resources from clients that have terminated in
  5211.            RetainPermanent or RetainTemporary mode.  It additionally
  5212.            includes deleting all but the predefined atom identifiers,
  5213.            deleting all properties on all root windows, resetting all
  5214.            device maps and attributes (key click, bell volume,
  5215.            acceleration), resetting the access control list, restoring
  5216.            the standard root tiles and cursors, restoring the default
  5217.            font path, and restoring the input focus to state
  5218.            PointerRoot.
  5219.  
  5220. SECTION 12.  EVENTS
  5221.  
  5222.       When a button is pressed with the pointer in some window W, and
  5223.       no active pointer grab is in progress, then the ancestors if W are
  5224.       searched from the root down, looking for a passive grab to
  5225.       activate.  If no matching passive grab on the button exists, then
  5226.       an active grab is started automatically for the client receiving
  5227.       the event, and the last-pointer-grab time is set to the current
  5228.       server time. The effect is essentially equivalent to a GrabButton
  5229.       with arguments:
  5230.            event-window: the event window
  5231.            event-mask: the client's selected events on the event window
  5232.            pointer-mode and keyboard-mode: Asynchronous
  5233.            owner-events: True if the client has OwnerGrabButton selected
  5234.                    on the event window, else False
  5235.            confine-to: None
  5236.            cursor: None
  5237.    The grab is terminated automatically when all buttons are released.
  5238.    UngrabPointer and ChangeActiveGrab can both be used to modify the
  5239.    active grab.
  5240.  
  5241.    KeyPress
  5242.      and
  5243.    KeyRelease
  5244.      and
  5245.  
  5246.  
  5247.  
  5248. M.I.T.                                                         [Page 89]
  5249.  
  5250. RFC 1013                                                       June 1987
  5251.  
  5252.  
  5253.    ButtonPress
  5254.      and
  5255.    ButtonRelease
  5256.      and
  5257.    MotionNotify
  5258.            root, event: WINDOW
  5259.            child: WINDOW or None
  5260.            same-screen: BOOL
  5261.            root-x, root-y, event-x, event-y: INT16
  5262.            detail: <see below>
  5263.            state: SETofKEYBUTMASK
  5264.            time: TIMESTAMP
  5265.  
  5266.            Generated when a key or button changes state, or the pointer
  5267.            moves. The "source" of the event is the window the pointer
  5268.            is in.  The window with respect to which the event is
  5269.            normally reported is found by looking up the hierarchy
  5270.            (starting with  the source window) for the first window on
  5271.            which any client has selected interest in the event,
  5272.            provided no intervening window prohibits event generation by
  5273.            including the event type in its do-not-propagate-mask.  The
  5274.            actual window used for reporting can be modified by active
  5275.            grabs and the focus window. The window the event is reported
  5276.            with respect to is called the "event" window.
  5277.  
  5278.            Root is the root window of the "source" window, and root-x
  5279.            and root-y are the pointer coordinates relative to root's
  5280.            origin at the time of the event.  Event is the "event"
  5281.            window.  If the event window is on the same screen as root,
  5282.            then event-x and event-y are the pointer coordinates relative
  5283.            to the event window's origin; otherwise event-x and event-y
  5284.            are zero.  If the source window is an inferior of the event
  5285.            window, then child is set to the child of the event window
  5286.            that is an ancestor of the source window.  The state
  5287.            component gives the state of the buttons and modifier keys
  5288.            just before the event.  The detailcomponent varies with
  5289.            the event type:
  5290.                KeyPress, KeyRelease:               KEYCODE
  5291.                ButtonPress, ButtonRelease:         BUTTON
  5292.                MotionNotify:                       {Normal, Hint}
  5293.  
  5294.            MotionNotify events are only generated when the motion
  5295.            begins and ends in the window.  The granularity of motion
  5296.            events is not guaranteed, but a client selecting for motion
  5297.            events is guaranteed to get at least one event when the
  5298.            pointer moves and comes to rest.  Selecting PointerMotion
  5299.            receives events independent of the state of the pointer
  5300.            buttons.  By selecting some subset of Button[1-5]Motion
  5301.            instead, MotionNotify events will only be received when one
  5302.            or more of the specified buttons are pressed.  By selecting
  5303.            ButtonMotion, MotionNotify events will received only when at
  5304.  
  5305.  
  5306.  
  5307. M.I.T.                                                         [Page 90]
  5308.  
  5309. RFC 1013                                                       June 1987
  5310.  
  5311.  
  5312.            least one button is pressed.  The events are always of type
  5313.            MotionNotify, independent of the selection. If
  5314.            PointerMotionHint is selected, the server is free to send
  5315.            only one MotionNotify event (with detail Hint) to the client
  5316.            for the event window, until either the key or button state
  5317.            changes, or the pointer leaves the event window, or the
  5318.            client issues a QueryPointer or GetMotionEvents request.
  5319.  
  5320.    EnterNotify
  5321.      and
  5322.    LeaveNotify
  5323.            root, event: WINDOW
  5324.            child: WINDOW or None
  5325.            same-screen: BOOL
  5326.            root-x, root-y, event-x, event-y: INT16
  5327.            mode: {Normal, Grab, Ungrab}
  5328.            detail: {Ancestor, Virtual, Inferior, Nonlinear,
  5329.                     NonlinearVirtual}
  5330.            focus: BOOL
  5331.            state: SETofKEYBUTMASK
  5332.            time: TIMESTAMP
  5333.  
  5334.            If pointer motion causes the pointer to be in a different
  5335.            window than before, EnterNotify and LeaveNotify events are
  5336.            generated instead of a  MotionNotify event.  Only clients
  5337.            selecting EnterWindow on a window receive EnterNotify events,
  5338.            and only clients selection LeaveNotifyreceive LeaveNotify
  5339.            events.  The pointer position reported in the event is always
  5340.            the "final" position, not the "initial" position of the
  5341.            pointer.  In a LeaveNotify event, if a child of the event
  5342.            window contains the "initial" position of the pointer, then
  5343.            the child component is set to that child, otherwise it is
  5344.            None.  For an EnterNotify event, if a child of the event
  5345.            window contains the "final" pointer position, then the child
  5346.            component is set to that child, otherwise it is None.  If
  5347.            the the event window is the focus window or an inferior of
  5348.            the focus window, then focus is True, and otherwisefocus is
  5349.            False.
  5350.  
  5351.            Normal pointer motion events have mode Normal; pseudo-motion
  5352.            events when a grab actives have mode Grab, and pseudo-motion
  5353.            events when a grab deactivates have mode Ungrab.
  5354.  
  5355.        Normal events are generated as follows:
  5356.  
  5357.        When the pointer moves from window A to window B, and A is an
  5358.        inferior of B:
  5359.            LeaveNotify with detail Ancestor is generated on A
  5360.            LeaveNotify with detail Virtual is generated on each window
  5361.            between A and B exclusive (in that order)
  5362.            EnterNotify with detail Inferior is generated on B
  5363.  
  5364.  
  5365.  
  5366. M.I.T.                                                         [Page 91]
  5367.  
  5368. RFC 1013                                                       June 1987
  5369.  
  5370.  
  5371.        When the pointer moves from window A to window B, and B is an
  5372.        inferior of A:
  5373.            LeaveNotify with detail Inferior is generated on A
  5374.            EnterNotify with detail Virtual is generated on each window
  5375.                    between A and B exclusive (in that order)
  5376.            EnterNotify with detail Ancestor is generated on B
  5377.  
  5378.        When the pointer moves from window A to window B, with window C
  5379.        being their least common ancestor:
  5380.            LeaveNotify with detail Nonlinear is generated on A
  5381.            LeaveNotify with detail NonlinearVirtual is generated on each
  5382.                    window between A and C exclusive (in that order)
  5383.            EnterNotify with detail NonlinearVirtual is generated on each
  5384.                    window between C and B exclusive (in that order)
  5385.            EnterNotify with detail Nonlinear is generated on B
  5386.  
  5387.        When the pointer moves from window A to window B, on different
  5388.        screens:
  5389.            LeaveNotify with detail Nonlinear is generated on A
  5390.            LeaveNotify with detail NonlinearVirtual is generated on each
  5391.                    window above A up to and including its root (in
  5392.                    order)
  5393.            EnterNotify with detail NonlinearVirtual is generated on each
  5394.            window
  5395.                    from B's root down to but not including B (in order)
  5396.            EnterNotify with detail Nonlinear is generated on B
  5397.  
  5398.        When a pointer grab activates (but after any initial warp into a
  5399.        confine-to window), with G the grab-window for the grab and P the
  5400.        window the pointer is in:
  5401.            EnterNotify and LeaveNotify events with mode Grab are
  5402.            generated (as for Normal above) as if the pointer were to
  5403.            suddenly warp from its current position in P to some position
  5404.            in G.However,  the pointer does not warp, and the pointer
  5405.            position is used as  both the "initial"and "final" positions
  5406.            for the events.
  5407.  
  5408.        When a pointer grab deactivates, with G the grab-window for the
  5409.        grab and P the window the pointer is in:
  5410.  
  5411.            EnterNotify and LeaveNotify events with mode Ungrab are
  5412.            generated (as for Normal above) as if the pointer were to
  5413.            suddenly warp from from some position in G to its current
  5414.            position in P.  However, the pointer does not warp, and the
  5415.            current pointer position is used as both the "initial" and
  5416.            "final" positions for the events.
  5417.  
  5418.    FocusIn
  5419.      and
  5420.    FocusOut
  5421.            event: WINDOW
  5422.  
  5423.  
  5424.  
  5425. M.I.T.                                                         [Page 92]
  5426.  
  5427. RFC 1013                                                       June 1987
  5428.  
  5429.  
  5430.            mode: {Normal, WhileGrabbed, Grab, Ungrab}
  5431.            detail: {Ancestor, Virtual, Inferior, Nonlinear,
  5432.                     NonlinearVirtual, Pointer, PointerRoot, None}
  5433.  
  5434.            Generated when the input focus changes.  Reported to clients
  5435.            selecting FocusChange on the window.  Events generated by
  5436.            SetInputFocus when the keyboard is not grabbed have mode
  5437.            Normal; events generated by SetInputFocus when the keyboard
  5438.            is grabbed have mode WhileGrabbed; events generated when a
  5439.            keyboard grab actives have mode Grab, and events generated
  5440.            when a keyboard grab deactivates have mode Ungrab.
  5441.  
  5442.        Normal and WhileGrabbed events are generated as follows:
  5443.  
  5444.        When the focus moves from window A to window B, and A is an
  5445.        inferior of B, with the pointer in window P:
  5446.            FocusOut with detail Ancestor is generated on A
  5447.            FocusOut with detail Virtual is generated on each window
  5448.            between A and B exclusive (in that order)
  5449.            FocusIn with detail Inferior is generated on B
  5450.            If P is an inferior of B, but P is not A or an inferior of A
  5451.                    or an ancestor of A, FocusIn with detail Pointer is
  5452.                    generated on each window below B down to and
  5453.                    including P (in order)
  5454.  
  5455.        When the focus moves from window A to window B, and B is an
  5456.        inferior of A, with the pointer in window P:
  5457.            If P is an inferior of A, but P is not A or an inferior of B
  5458.                    or an ancestor of B, FocusOut with detail Pointer is
  5459.                    generated on each window from P up to but not
  5460.                    including A (in order)
  5461.            FocusOut with detail Inferior is generated on A
  5462.            FocusIn with detail Virtual is generated on each window
  5463.                    between A and B exclusive (in that order)
  5464.            FocusIn with detail Ancestor is generated on B
  5465.  
  5466.        When the focus moves from window A to window B, with window C
  5467.        being their least common ancestor, and with the pointer in
  5468.        window P:
  5469.            If P is an inferior of A, FocusOut with detail Pointer is
  5470.                    generated on each window from P up to but not
  5471.                    including A (in order)
  5472.            FocusOut with detail Nonlinear is generated on A
  5473.            FocusOut with detail NonlinearVirtual is generated on each
  5474.                    window between A and C exclusive (in that order)
  5475.            FocusIn with detail NonlinearVirtual is generated on each
  5476.                    window between C and B exclusive (in that order)
  5477.            FocusIn with detail Nonlinear is generated on B
  5478.            If P is an inferior of B, FocusIn with detail Pointer is
  5479.                    generated on each window below B down to and
  5480.                    including P (in order)
  5481.  
  5482.  
  5483.  
  5484. M.I.T.                                                         [Page 93]
  5485.  
  5486. RFC 1013                                                       June 1987
  5487.  
  5488.  
  5489.        When the focus moves from window A to window B, on different
  5490.        screens, with the pointer in window P:
  5491.            If P is an inferior of A, FocusOut with detail Pointer is
  5492.                    generated on each window from P up to but not
  5493.                    including A (in order)
  5494.            FocusOut with detail Nonlinear is generated on A
  5495.            FocusOut with detail NonlinearVirtual is generated on each
  5496.                    window above A up to and including its root (in
  5497.                    order)
  5498.            FocusIn with detail NonlinearVirtual is generated on each
  5499.                    window from B's root down to but not including B
  5500.                    (in order)
  5501.            FocusIn with detail Nonlinear is generated on B
  5502.            If P is an inferior of B, FocusIn with detail Pointer is
  5503.                    generated on each window below B down to and
  5504.                    including P (in order)
  5505.  
  5506.        When the focus moves from window A to PointerRoot (or None)
  5507.            If P is an inferior of A, FocusOut with detail Pointer is
  5508.                    generated on each window from P up to but not
  5509.                    including A (in order)
  5510.            FocusOut with detail Nonlinear is generated on A
  5511.            FocusOut with detail NonlinearVirtual is generated on each
  5512.                    window above A up to and including its root (in
  5513.                    order)
  5514.            FocusIn with detail PointerRoot (or None) is generated on
  5515.                    all root windows
  5516.  
  5517.        When the focus moves from PointerRoot (or None) to window A:
  5518.            FocusOut with detail PointerRoot (or None) is generated on
  5519.                    all root windows
  5520.            FocusIn with detail NonlinearVirtual is generated on each
  5521.                    window from A's root down to but not including A
  5522.                    (in order)
  5523.            FocusIn with detail Nonlinear is generated on A
  5524.            If P is an inferior of A, FocusIn with detail Pointer is
  5525.                    generated on each window below A down to and
  5526.                    including P (in order)
  5527.  
  5528.        When the focus moves from PointerRoot to None (or vice versa):
  5529.            FocusOut with detail PointerRoot (or None) is generated on
  5530.                    all root windows
  5531.            FocusIn with detail None (or PointerRoot) is generated on
  5532.                    all root windows
  5533.  
  5534.        When a keyboard grab activates, with G the grab-window for the
  5535.        grab and F the current focus:
  5536.            FocusIn and FocusOut events with mode Grab are generated (as
  5537.            for Normal above) as if the focus were to change from F to G
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543. M.I.T.                                                         [Page 94]
  5544.  
  5545. RFC 1013                                                       June 1987
  5546.  
  5547.  
  5548.        When a keyboard grab deactivates, with G the grab-window for the
  5549.        grab and F the current focus:
  5550.            FocusIn and FocusOut events with mode Ungrab are generated
  5551.            (as for Normal above) as if the focus were to change from G
  5552.            to F
  5553.  
  5554.    KeymapNotify
  5555.            keys: LISTofCARD8
  5556.  
  5557.            The value is a bit vector, as described in QueryKeymap.
  5558.            Reported to clients selecting KeymapState on a window.
  5559.            Generated immediately after every EnterNotify and FocusIn.
  5560.  
  5561.    Expose
  5562.            window: WINDOW
  5563.            x, y, width, height: CARD16
  5564.            last-in-series: BOOL
  5565.  
  5566.            Reported to clients selecting Exposure on the window.
  5567.            Possibly generated when a region of the window becomes
  5568.            viewable, but might only be generated when a region becomes
  5569.            visible. All of the regions exposed by a given "action" are
  5570.            guaranteed to be reported contiguously; if last-in-series is
  5571.            False then another exposure follows.
  5572.  
  5573.            The x and y coordinates are relative to drawable's origin,
  5574.            and  specify the upper left corner of a rectangule.  The
  5575.            width and height specify the extent of the rectangle.
  5576.  
  5577.            Expose events are never generated on InputOnly windows.
  5578.  
  5579. GraphicsExposure
  5580.            drawable: DRAWABLE
  5581.            x, y, width, height: CARD16
  5582.            last-in-series: BOOL
  5583.            major-opcode: CARD8
  5584.            minor-opcode: CARD16
  5585.  
  5586.            Reported to clients selecting graphics-exposures in a
  5587.            graphics context. Generated when a destination region could
  5588.            not be computed due to an obscured or out-of-bounds source
  5589.            region.  All of the regions exposed by a given graphics
  5590.            request are guaranteed to be reported contiguously; if
  5591.            last-in-series is False then another exposure follows.
  5592.  
  5593.            The x and y coordinates are relative to drawable's origin,
  5594.            and specify the upper left corner of a rectangule.  The width
  5595.            and height specify the extent of the rectangle.
  5596.  
  5597.            The major and minor opcodes identify the graphics request
  5598.            used.  For the core protocol, major-opcode is always
  5599.  
  5600.  
  5601.  
  5602. M.I.T.                                                         [Page 95]
  5603.  
  5604. RFC 1013                                                       June 1987
  5605.  
  5606.  
  5607.            CopyArea or CopyPlane and minor-opcode is always zero.
  5608.  
  5609. NoExposure
  5610.            drawable: DRAWABLE
  5611.            major-opcode: CARD8
  5612.            minor-opcode: CARD16
  5613.  
  5614.            Reported to clients selecting graphics-exposures in a
  5615.            graphics context. Generated when a graphics request that
  5616.            might produce GraphicsExposure events does not produce any.
  5617.            The drawable specifies the destination used for the
  5618.            graphics request.
  5619.  
  5620.            The major and minor opcodes identify the graphics request
  5621.            used.  For the core protocol, major-opcode is always CopyArea
  5622.            or CopyPlane and minor-opcode is always zero.
  5623.  
  5624. VisibilityNotify
  5625.            window: WINDOW
  5626.            state: {Unobscured, PartiallyObscured, FullyObscured}
  5627.  
  5628.            Reported to clients selecting VisibilityChange on the
  5629.            window.  In the following, the state of the window is
  5630.            calculated ignoring all of the window's subwindows.  When
  5631.            a window changes state from partially or fully obscured or
  5632.            not viewable to viewable and completely unobscured, an
  5633.            event with Unobscured  is generated.  When a window changes
  5634.            state from a) viewable and completely unobscured or b) not
  5635.            viewable, to viewable and partially obscured, an event with
  5636.            PartiallyObscured is generated.  When a window changes state
  5637.            from a) viewable and completely unobscured or b) viewable and
  5638.            partially obscured or c) not viewable, to viewable and fully
  5639.            obscured, an event with FullyObscured is generated.
  5640.  
  5641.            VisibilityNotify events are never generated on InputOnly
  5642.            windows.
  5643.  
  5644. CreateNotify
  5645.            parent, window: WINDOW
  5646.            x, y: INT16
  5647.            width, height, border-width: CARD16
  5648.            override-redirect: BOOL
  5649.  
  5650.            Reported to clients selecting SubstructureNotify on the
  5651.            parent. Generated when the window is created.  The arguments
  5652.            are as in the CreateWindow request.
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661. M.I.T.                                                         [Page 96]
  5662.  
  5663. RFC 1013                                                       June 1987
  5664.  
  5665.  
  5666. DestroyNotify
  5667.            event, window: WINDOW
  5668.  
  5669.            Reported to clients selecting StructureNotify on the window,
  5670.            and to clients selecting SubstructureNotify on the parent.
  5671.            Generated when the window is destroyed.  "Event" is the
  5672.            window on which the event was   generated, and "window" is
  5673.            the window that is destroyed.
  5674.  
  5675. UnmapNotify
  5676.            event, window: WINDOW
  5677.            from-configure: BOOL
  5678.  
  5679.            Reported to clients selecting StructureNotify on the window,
  5680.            and to clients selecting SubstructureNotify on the parent.
  5681.            Generated when the window changes state from mapped to
  5682.            unmapped. "Event" is the window on which the event was
  5683.            generated, and "window" is the window that is unmapped.  The
  5684.            from-configure flag is True if the event was generated  as a
  5685.            result of the window's parent being resized when the window
  5686.            itself had a win-gravity of Unmap.
  5687.  
  5688. MapNotify
  5689.            event, window: WINDOW
  5690.            override-redirect: BOOL
  5691.  
  5692.            Reported to clients selecting StructureNotify on the window,
  5693.            and to clients selecting SubstructureNotify on the parent.
  5694.            Generated when the window changes state from unmapped to
  5695.            mapped. "Event" is the window on which the event was
  5696.            generated, and "window" is the window that is mapped.  The
  5697.            override-redirect flag is from the window's attribute.
  5698.  
  5699. MapRequest
  5700.            parent, window: WINDOW
  5701.  
  5702.            Reported to the client selecting SubstructureRedirect on the
  5703.            parent. Generated when a MapWindow request is issued on an
  5704.            unmapped window with an override-redirect attribute of False.
  5705.  
  5706. ReparentNotify
  5707.            event, window, parent: WINDOW
  5708.            x, y: INT16
  5709.            override-redirect: BOOL
  5710.  
  5711.            Reported to clients selecting SubstructureNotify on either
  5712.            the old or the new parent, and to clients selecting
  5713.            StructureNotify on the window.  Generated when the window
  5714.            is reparented.  "Event" is the window on which the event
  5715.            was generated, "window" is the window that has been
  5716.            re-rooted, and "parent" specifies the new parent.  The x
  5717.  
  5718.  
  5719.  
  5720. M.I.T.                                                         [Page 97]
  5721.  
  5722. RFC 1013                                                       June 1987
  5723.  
  5724.  
  5725.            and y coordinates are relative to the new parent's origin,
  5726.            and specify the position of the upper left outer corner of
  5727.            the window.  The override-redirect flag is from the
  5728.            window's attribute.
  5729.  
  5730. ConfigureNotify
  5731.            event, window: WINDOW
  5732.            x, y: INT16
  5733.            width, height, border-width: CARD16
  5734.            above-sibling: WINDOW or None
  5735.            override-redirect: BOOL
  5736.  
  5737.            Reported to clients selecting StructureNotify on the window,
  5738.            and to clients selecting SubstructureNotify on the parent.
  5739.            Generated when a ConfigureWindow request actually changes the
  5740.            state of the window. "Event" is the window on which the event
  5741.            was generated, and "window" is the window that is changed.
  5742.            If above-sibling is None, then the window is on the bottom of
  5743.            the stack with respect to siblings; otherwise, the window is
  5744.            immediately on top of the specified sibling.  The
  5745.            override-redirect flag is from the window's attribute.
  5746.  
  5747. GravityNotify
  5748.            event, window: WINDOW
  5749.            x, y: INT16
  5750.  
  5751.            Reported to clients selecting SubstructureNotify on the
  5752.            parent, and to clients selecting StructureNotify on the
  5753.            window.  Generated when a window is moved because of a
  5754.            change in size of the parent.  "Event" is the window on
  5755.            which the event was generated, and "window" is the
  5756.            window that is moved.
  5757.  
  5758. ResizeRequest
  5759.            window: WINDOW
  5760.            width, height: CARD16
  5761.  
  5762.            Reported to the client selecting ResizeRedirect on the
  5763.            window. Generated when a ConfigureWindow request by some
  5764.            other client on the window attempts to change the size of the
  5765.            window. The width and height are the inside size, not
  5766.            including the border.
  5767.  
  5768. ConfigureRequest
  5769.            parent, window: WINDOW
  5770.            x, y: INT16
  5771.            width, height, border-width: CARD16
  5772.            above-sibling: WINDOW or None
  5773.  
  5774.            Reported to the client selecting SubstructureRedirect on the
  5775.            parent. Generated when a ConfigureWindow request is issued on
  5776.  
  5777.  
  5778.  
  5779. M.I.T.                                                         [Page 98]
  5780.  
  5781. RFC 1013                                                       June 1987
  5782.  
  5783.  
  5784.            the window by some other client.  The geometry is as derived
  5785.            from the request.  The above-sibling is the sibling the
  5786.            window should be placed directly on top of; if None, then the
  5787.            window should be placed on the bottom.
  5788.  
  5789. CirculateNotify
  5790.            event, window: WINDOW
  5791.            place: {Top, Bottom}
  5792.  
  5793.            Reported to clients selecting StructureNotify on the window,
  5794.            and to clients selecting SubstructureNotify on the parent.
  5795.            Generated when the window is actually restacked from a
  5796.            CirculateWindow request.  "Event" is the window on which the
  5797.            event was generated, and "window" is the window that is
  5798.            restacked.  If place is Top, the window is now on top of all
  5799.            siblings; otherwise it is below all siblings.
  5800.  
  5801. CirculateRequest
  5802.            parent, window: WINDOW
  5803.            place: {Top, Bottom}
  5804.  
  5805.            Reported to the client selecting SubstructureRedirect on the
  5806.            parent. Generated when a CirculateWindow request is issued on
  5807.            the parent and a window actually needs to be restacked.  The
  5808.            window specifies the window to be restacked, and place
  5809.            specifies what the new position in the stacking order should
  5810.            be.
  5811.  
  5812. PropertyNotify
  5813.            window: WINDOW
  5814.            atom: ATOM
  5815.            state: {NewValue, Deleted}
  5816.            time: TIMESTAMP
  5817.  
  5818.            Reported to clients selecting PropertyChange on the window.
  5819.            Generated when a property of the window is changed.  The
  5820.            timestamp indicates the server time when the property was
  5821.            changed.
  5822.  
  5823. SelectionClear
  5824.            owner: WINDOW
  5825.            selection: ATOM
  5826.            time: TIMESTAMP
  5827.  
  5828.            Reported to the current owner of a selection.  Generated on
  5829.            the window losing ownership when a new owner is being
  5830.            defined.  The timestamp is the last-change time recorded for
  5831.            the selection.
  5832.  
  5833. SelectionRequest
  5834.            owner: WINDOW
  5835.  
  5836.  
  5837.  
  5838. M.I.T.                                                         [Page 99]
  5839.  
  5840. RFC 1013                                                       June 1987
  5841.  
  5842.  
  5843.            selection: ATOM
  5844.            target: ATOM
  5845.            property: ATOM or None
  5846.            requestor: WINDOW
  5847.            time: TIMESTAMP or CurrentTime
  5848.  
  5849.            Reported to the owner of a selection.  Generated when a
  5850.            client issues a ConvertSelection request. The arguments are
  5851.            as in the request.
  5852.  
  5853.            The owner should convert the selection based on the specified
  5854.            target type.  If a property is specified, the owner should
  5855.            store the result as that property on the requestor window,
  5856.            and then send a SelectionNotify event to the requestor using
  5857.            SendEvent.  If the selection cannot be converted as
  5858.            requested, the owner should send a SelectionNotify with the
  5859.            property set to None.
  5860.  
  5861. SelectionNotify
  5862.            requestor: WINDOW
  5863.            selection, target: ATOM
  5864.            property: ATOM or None
  5865.            time: TIMESTAMP or CurrentTime
  5866.  
  5867.            This event is only generated by clients using SendEvent.  The
  5868.            owner of a selection should send this event to a requestor
  5869.            when a selection has been converted and stored as a property,
  5870.            or when a selection conversion could not be performed
  5871.            (indicated with property None).
  5872.  
  5873. ColormapNotify
  5874.            window: WINDOW
  5875.            colormap: COLORMAP or None
  5876.            new: BOOL
  5877.            state: {Installed, Uninstalled}
  5878.  
  5879.            Reported to clients selecting ColormapChange on the window.
  5880.            Generated with value True for new when the colormap attribute
  5881.            of the window is changed.  Generated with value False for new
  5882.            when the colormap of a window is installed or uninstalled. In
  5883.            either case, state indicates whether the colormap is
  5884.            currently installed.
  5885.  
  5886. ClientMessage
  5887.            window: WINDOW
  5888.            type: ATOM
  5889.            format: {8, 16, 32}
  5890.            data: LISTofINT8 or LISTofINT16 or LISTofINT32
  5891.  
  5892.            This event is only generated by clients using SendEvent.  The
  5893.            type specifies how the data is to be interpreted by the
  5894.  
  5895.  
  5896.  
  5897. M.I.T.                                                        [Page 100]
  5898.  
  5899. RFC 1013                                                       June 1987
  5900.  
  5901.  
  5902.            receiving client; the server places no interpretation on the
  5903.            type or the data.  The format specifies whether the data
  5904.            should be viewed as a list of 8-bit, 16-bit, or 32-bit
  5905.            quantities, so that the server can correctly byte-swap as
  5906.            necessary. The data always consists of either 20 8-bit values
  5907.            or 10 16-bit values or 5 32-bit values, although particular
  5908.            message types might not make use of all of these values.
  5909.  
  5910. SECTION 13.  FLOW CONTROL AND CONCURRENCY
  5911.  
  5912.     Whenever the server is writing to a given connection, it is
  5913.     permissible for the server to stop reading from that connection (but
  5914.     if the writing would block it must continue to service other
  5915.     connections).  The server is not required to buffer more than a
  5916.     single request per connection at one time.  For a given connection
  5917.     to the server, a client can block while reading from the connection,
  5918.     but should undertake to read (events and errors) when writing would
  5919.     block. Failure on the part of a client to obey this rule could
  5920.     result in a deadlocked connection, although deadlock is probably
  5921.     unlikely unless the transport layer has very little buffering, or
  5922.     unless the client attempts to send large numbers of requests without
  5923.     ever reading replies or checking for errors and events.
  5924.  
  5925.     If a server is implemented with internal concurrency, the overall
  5926.     effect must be as if individual requests are executed to completion
  5927.     in some serial order, and that requests from a given connection are
  5928.     executed in delivery order (i.e., the total execution order is a
  5929.     shuffle of the individual streams).  The "execution" of a request
  5930.     includes validating all arguments, collecting all data for any
  5931.     reply, and generating (and queueing) all required events, but does
  5932.     not include the actual transmission of the reply and the events.
  5933.     In addition, the   effect of any other "cause" (e.g., activation of
  5934.     a grab, pointer motion) that can generate multiple events must
  5935.     effectively generate (and queue) all required events indivisibly
  5936.     with respect to all other causes and requests.
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.  
  5945.  
  5946.  
  5947.  
  5948.  
  5949.  
  5950.  
  5951.  
  5952.  
  5953.  
  5954.  
  5955.  
  5956. M.I.T.                                                        [Page 101]
  5957.  
  5958.